@symmio/trading-core 4.0.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (447) hide show
  1. package/dist/balance-history/get-balance-history/types.d.ts +3 -1
  2. package/dist/balance-history/get-balance-history/types.d.ts.map +1 -1
  3. package/dist/balance-history/get-balance-history/types.js +1 -1
  4. package/dist/balance-history/get-balance-history/types.js.map +1 -1
  5. package/dist/funding/get-funding-index-checkpoints/get-funding-index-checkpoints.d.ts +50 -0
  6. package/dist/funding/get-funding-index-checkpoints/get-funding-index-checkpoints.d.ts.map +1 -0
  7. package/dist/funding/get-funding-index-checkpoints/get-funding-index-checkpoints.js +30 -0
  8. package/dist/funding/get-funding-index-checkpoints/get-funding-index-checkpoints.js.map +1 -0
  9. package/dist/funding/get-funding-index-checkpoints/index.d.ts +5 -0
  10. package/dist/funding/get-funding-index-checkpoints/index.d.ts.map +1 -0
  11. package/dist/funding/get-funding-index-checkpoints/query-document.d.ts +16 -0
  12. package/dist/funding/get-funding-index-checkpoints/query-document.d.ts.map +1 -0
  13. package/dist/funding/get-funding-index-checkpoints/query-document.js +7 -0
  14. package/dist/funding/get-funding-index-checkpoints/query-document.js.map +1 -0
  15. package/dist/funding/get-funding-index-checkpoints/query.d.ts +37 -0
  16. package/dist/funding/get-funding-index-checkpoints/query.d.ts.map +1 -0
  17. package/dist/funding/get-funding-index-checkpoints/query.js +23 -0
  18. package/dist/funding/get-funding-index-checkpoints/query.js.map +1 -0
  19. package/dist/funding/get-funding-index-checkpoints/to-funding-index-checkpoint-row.d.ts +12 -0
  20. package/dist/funding/get-funding-index-checkpoints/to-funding-index-checkpoint-row.d.ts.map +1 -0
  21. package/dist/funding/get-funding-index-checkpoints/to-funding-index-checkpoint-row.js +31 -0
  22. package/dist/funding/get-funding-index-checkpoints/to-funding-index-checkpoint-row.js.map +1 -0
  23. package/dist/funding/get-funding-index-checkpoints/types.d.ts +51 -0
  24. package/dist/funding/get-funding-index-checkpoints/types.d.ts.map +1 -0
  25. package/dist/funding/get-quote-funding-settlements/get-quote-funding-settlements.d.ts +47 -0
  26. package/dist/funding/get-quote-funding-settlements/get-quote-funding-settlements.d.ts.map +1 -0
  27. package/dist/funding/get-quote-funding-settlements/get-quote-funding-settlements.js +30 -0
  28. package/dist/funding/get-quote-funding-settlements/get-quote-funding-settlements.js.map +1 -0
  29. package/dist/funding/get-quote-funding-settlements/index.d.ts +5 -0
  30. package/dist/funding/get-quote-funding-settlements/index.d.ts.map +1 -0
  31. package/dist/funding/get-quote-funding-settlements/query-document.d.ts +16 -0
  32. package/dist/funding/get-quote-funding-settlements/query-document.d.ts.map +1 -0
  33. package/dist/funding/get-quote-funding-settlements/query-document.js +7 -0
  34. package/dist/funding/get-quote-funding-settlements/query-document.js.map +1 -0
  35. package/dist/funding/get-quote-funding-settlements/query.d.ts +37 -0
  36. package/dist/funding/get-quote-funding-settlements/query.d.ts.map +1 -0
  37. package/dist/funding/get-quote-funding-settlements/query.js +23 -0
  38. package/dist/funding/get-quote-funding-settlements/query.js.map +1 -0
  39. package/dist/funding/get-quote-funding-settlements/to-quote-funding-settlement-row.d.ts +12 -0
  40. package/dist/funding/get-quote-funding-settlements/to-quote-funding-settlement-row.d.ts.map +1 -0
  41. package/dist/funding/get-quote-funding-settlements/to-quote-funding-settlement-row.js +33 -0
  42. package/dist/funding/get-quote-funding-settlements/to-quote-funding-settlement-row.js.map +1 -0
  43. package/dist/funding/get-quote-funding-settlements/types.d.ts +56 -0
  44. package/dist/funding/get-quote-funding-settlements/types.d.ts.map +1 -0
  45. package/dist/funding/index.d.ts +3 -0
  46. package/dist/funding/index.d.ts.map +1 -0
  47. package/dist/index.d.ts +63 -4
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +427 -386
  50. package/dist/liquidation/get-liquidation-details/get-liquidation-details.d.ts +44 -0
  51. package/dist/liquidation/get-liquidation-details/get-liquidation-details.d.ts.map +1 -0
  52. package/dist/liquidation/get-liquidation-details/get-liquidation-details.js +30 -0
  53. package/dist/liquidation/get-liquidation-details/get-liquidation-details.js.map +1 -0
  54. package/dist/liquidation/get-liquidation-details/index.d.ts +5 -0
  55. package/dist/liquidation/get-liquidation-details/index.d.ts.map +1 -0
  56. package/dist/liquidation/get-liquidation-details/query-document.d.ts +16 -0
  57. package/dist/liquidation/get-liquidation-details/query-document.d.ts.map +1 -0
  58. package/dist/liquidation/get-liquidation-details/query-document.js +7 -0
  59. package/dist/liquidation/get-liquidation-details/query-document.js.map +1 -0
  60. package/dist/liquidation/get-liquidation-details/query.d.ts +37 -0
  61. package/dist/liquidation/get-liquidation-details/query.d.ts.map +1 -0
  62. package/dist/liquidation/get-liquidation-details/query.js +23 -0
  63. package/dist/liquidation/get-liquidation-details/query.js.map +1 -0
  64. package/dist/liquidation/get-liquidation-details/to-liquidation-detail-row.d.ts +12 -0
  65. package/dist/liquidation/get-liquidation-details/to-liquidation-detail-row.d.ts.map +1 -0
  66. package/dist/liquidation/get-liquidation-details/to-liquidation-detail-row.js +32 -0
  67. package/dist/liquidation/get-liquidation-details/to-liquidation-detail-row.js.map +1 -0
  68. package/dist/liquidation/get-liquidation-details/types.d.ts +47 -0
  69. package/dist/liquidation/get-liquidation-details/types.d.ts.map +1 -0
  70. package/dist/liquidation/index.d.ts +2 -0
  71. package/dist/liquidation/index.d.ts.map +1 -0
  72. package/dist/margin/get-margin-transfers/get-margin-transfers.d.ts +51 -0
  73. package/dist/margin/get-margin-transfers/get-margin-transfers.d.ts.map +1 -0
  74. package/dist/margin/get-margin-transfers/get-margin-transfers.js +32 -0
  75. package/dist/margin/get-margin-transfers/get-margin-transfers.js.map +1 -0
  76. package/dist/margin/get-margin-transfers/index.d.ts +5 -0
  77. package/dist/margin/get-margin-transfers/index.d.ts.map +1 -0
  78. package/dist/margin/get-margin-transfers/query-document.d.ts +17 -0
  79. package/dist/margin/get-margin-transfers/query-document.d.ts.map +1 -0
  80. package/dist/margin/get-margin-transfers/query-document.js +7 -0
  81. package/dist/margin/get-margin-transfers/query-document.js.map +1 -0
  82. package/dist/margin/get-margin-transfers/query.d.ts +37 -0
  83. package/dist/margin/get-margin-transfers/query.d.ts.map +1 -0
  84. package/dist/margin/get-margin-transfers/query.js +23 -0
  85. package/dist/margin/get-margin-transfers/query.js.map +1 -0
  86. package/dist/margin/get-margin-transfers/to-margin-transfer-row.d.ts +12 -0
  87. package/dist/margin/get-margin-transfers/to-margin-transfer-row.d.ts.map +1 -0
  88. package/dist/margin/get-margin-transfers/to-margin-transfer-row.js +19 -0
  89. package/dist/margin/get-margin-transfers/to-margin-transfer-row.js.map +1 -0
  90. package/dist/margin/get-margin-transfers/types.d.ts +27 -0
  91. package/dist/margin/get-margin-transfers/types.d.ts.map +1 -0
  92. package/dist/margin/index.d.ts +1 -0
  93. package/dist/margin/index.d.ts.map +1 -1
  94. package/dist/pools/add-market/to-created-pool.d.ts.map +1 -1
  95. package/dist/pools/add-market/to-created-pool.js +4 -0
  96. package/dist/pools/add-market/to-created-pool.js.map +1 -1
  97. package/dist/pools/add-market/types.d.ts +8 -0
  98. package/dist/pools/add-market/types.d.ts.map +1 -1
  99. package/dist/pools/auth/authenticate-listing.d.ts +3 -1
  100. package/dist/pools/auth/authenticate-listing.d.ts.map +1 -1
  101. package/dist/pools/auth/authenticate-listing.js +28 -23
  102. package/dist/pools/auth/authenticate-listing.js.map +1 -1
  103. package/dist/pools/auth/can-reuse-listing-challenge.d.ts +5 -0
  104. package/dist/pools/auth/can-reuse-listing-challenge.d.ts.map +1 -0
  105. package/dist/pools/auth/can-reuse-listing-challenge.js +9 -0
  106. package/dist/pools/auth/can-reuse-listing-challenge.js.map +1 -0
  107. package/dist/pools/auth/query.d.ts +15 -0
  108. package/dist/pools/auth/query.d.ts.map +1 -1
  109. package/dist/pools/auth/query.js +28 -4
  110. package/dist/pools/auth/query.js.map +1 -1
  111. package/dist/pools/auth/to-siwe.d.ts +5 -1
  112. package/dist/pools/auth/to-siwe.d.ts.map +1 -1
  113. package/dist/pools/auth/to-siwe.js +4 -2
  114. package/dist/pools/auth/to-siwe.js.map +1 -1
  115. package/dist/pools/auth/types.d.ts +2 -0
  116. package/dist/pools/auth/types.d.ts.map +1 -1
  117. package/dist/pools/cancel-withdraw/cancel-withdraw.js +1 -1
  118. package/dist/pools/cancel-withdraw/cancel-withdraw.js.map +1 -1
  119. package/dist/pools/claim-history/get-pool-claim.d.ts +11 -0
  120. package/dist/pools/claim-history/get-pool-claim.d.ts.map +1 -0
  121. package/dist/pools/claim-history/get-pool-claim.js +25 -0
  122. package/dist/pools/claim-history/get-pool-claim.js.map +1 -0
  123. package/dist/pools/claim-history/index.d.ts +1 -0
  124. package/dist/pools/claim-history/index.d.ts.map +1 -1
  125. package/dist/pools/claim-history/to-pool-claim.d.ts.map +1 -1
  126. package/dist/pools/claim-history/to-pool-claim.js +2 -0
  127. package/dist/pools/claim-history/to-pool-claim.js.map +1 -1
  128. package/dist/pools/composition.d.ts +16 -0
  129. package/dist/pools/composition.d.ts.map +1 -0
  130. package/dist/pools/composition.js +39 -0
  131. package/dist/pools/composition.js.map +1 -0
  132. package/dist/pools/empty-pool-profit.d.ts +4 -0
  133. package/dist/pools/empty-pool-profit.d.ts.map +1 -0
  134. package/dist/pools/empty-pool-profit.js +17 -0
  135. package/dist/pools/empty-pool-profit.js.map +1 -0
  136. package/dist/pools/index.d.ts +8 -0
  137. package/dist/pools/index.d.ts.map +1 -1
  138. package/dist/pools/listing-config/to-listing-config.d.ts +5 -1
  139. package/dist/pools/listing-config/to-listing-config.d.ts.map +1 -1
  140. package/dist/pools/listing-config/to-listing-config.js +19 -8
  141. package/dist/pools/listing-config/to-listing-config.js.map +1 -1
  142. package/dist/pools/maintenance-fees/get-pool-maintenance-fees.d.ts +37 -0
  143. package/dist/pools/maintenance-fees/get-pool-maintenance-fees.d.ts.map +1 -0
  144. package/dist/pools/maintenance-fees/get-pool-maintenance-fees.js +35 -0
  145. package/dist/pools/maintenance-fees/get-pool-maintenance-fees.js.map +1 -0
  146. package/dist/pools/maintenance-fees/index.d.ts +3 -0
  147. package/dist/pools/maintenance-fees/index.d.ts.map +1 -0
  148. package/dist/pools/maintenance-fees/query.d.ts +11 -0
  149. package/dist/pools/maintenance-fees/query.d.ts.map +1 -0
  150. package/dist/pools/maintenance-fees/query.js +21 -0
  151. package/dist/pools/maintenance-fees/query.js.map +1 -0
  152. package/dist/pools/market-config/to-listing-market-config.d.ts +6 -1
  153. package/dist/pools/market-config/to-listing-market-config.d.ts.map +1 -1
  154. package/dist/pools/market-config/to-listing-market-config.js +1 -0
  155. package/dist/pools/market-config/to-listing-market-config.js.map +1 -1
  156. package/dist/pools/market-config/types.d.ts +5 -0
  157. package/dist/pools/market-config/types.d.ts.map +1 -1
  158. package/dist/pools/market-config/types.js.map +1 -1
  159. package/dist/pools/market-data/get-pool-market-data.d.ts +14 -0
  160. package/dist/pools/market-data/get-pool-market-data.d.ts.map +1 -0
  161. package/dist/pools/market-data/get-pool-market-data.js +25 -0
  162. package/dist/pools/market-data/get-pool-market-data.js.map +1 -0
  163. package/dist/pools/market-data/index.d.ts +2 -0
  164. package/dist/pools/market-data/index.d.ts.map +1 -0
  165. package/dist/pools/market-detail/to-listing-market-detail.d.ts +5 -1
  166. package/dist/pools/market-detail/to-listing-market-detail.d.ts.map +1 -1
  167. package/dist/pools/market-detail/to-listing-market-detail.js +45 -33
  168. package/dist/pools/market-detail/to-listing-market-detail.js.map +1 -1
  169. package/dist/pools/markets/to-listing-market.d.ts +13 -1
  170. package/dist/pools/markets/to-listing-market.d.ts.map +1 -1
  171. package/dist/pools/markets/to-listing-market.js +24 -12
  172. package/dist/pools/markets/to-listing-market.js.map +1 -1
  173. package/dist/pools/open-positions/calculate-pool-open-positions.d.ts +39 -0
  174. package/dist/pools/open-positions/calculate-pool-open-positions.d.ts.map +1 -0
  175. package/dist/pools/open-positions/calculate-pool-open-positions.js +83 -0
  176. package/dist/pools/open-positions/calculate-pool-open-positions.js.map +1 -0
  177. package/dist/pools/open-positions/get-pool-open-positions.d.ts +17 -0
  178. package/dist/pools/open-positions/get-pool-open-positions.d.ts.map +1 -0
  179. package/dist/pools/open-positions/get-pool-open-positions.js +39 -0
  180. package/dist/pools/open-positions/get-pool-open-positions.js.map +1 -0
  181. package/dist/pools/open-positions/index.d.ts +4 -0
  182. package/dist/pools/open-positions/index.d.ts.map +1 -0
  183. package/dist/pools/open-positions/query.d.ts +17 -0
  184. package/dist/pools/open-positions/query.d.ts.map +1 -0
  185. package/dist/pools/open-positions/query.js +21 -0
  186. package/dist/pools/open-positions/query.js.map +1 -0
  187. package/dist/pools/portfolio/calculate-pool-portfolio.d.ts +66 -0
  188. package/dist/pools/portfolio/calculate-pool-portfolio.d.ts.map +1 -0
  189. package/dist/pools/portfolio/calculate-pool-portfolio.js +96 -0
  190. package/dist/pools/portfolio/calculate-pool-portfolio.js.map +1 -0
  191. package/dist/pools/portfolio/get-pool-portfolio.d.ts +19 -0
  192. package/dist/pools/portfolio/get-pool-portfolio.d.ts.map +1 -0
  193. package/dist/pools/portfolio/get-pool-portfolio.js +88 -0
  194. package/dist/pools/portfolio/get-pool-portfolio.js.map +1 -0
  195. package/dist/pools/portfolio/index.d.ts +4 -0
  196. package/dist/pools/portfolio/index.d.ts.map +1 -0
  197. package/dist/pools/portfolio/query.d.ts +17 -0
  198. package/dist/pools/portfolio/query.d.ts.map +1 -0
  199. package/dist/pools/portfolio/query.js +21 -0
  200. package/dist/pools/portfolio/query.js.map +1 -0
  201. package/dist/pools/portfolio/read-positions.d.ts +4 -0
  202. package/dist/pools/portfolio/read-positions.d.ts.map +1 -0
  203. package/dist/pools/portfolio/read-positions.js +31 -0
  204. package/dist/pools/portfolio/read-positions.js.map +1 -0
  205. package/dist/pools/position/calculate-pool-position.d.ts +85 -0
  206. package/dist/pools/position/calculate-pool-position.d.ts.map +1 -0
  207. package/dist/pools/position/calculate-pool-position.js +59 -0
  208. package/dist/pools/position/calculate-pool-position.js.map +1 -0
  209. package/dist/pools/position/get-pool-position.d.ts +22 -0
  210. package/dist/pools/position/get-pool-position.d.ts.map +1 -0
  211. package/dist/pools/position/get-pool-position.js +47 -0
  212. package/dist/pools/position/get-pool-position.js.map +1 -0
  213. package/dist/pools/position/index.d.ts +4 -0
  214. package/dist/pools/position/index.d.ts.map +1 -0
  215. package/dist/pools/position/query.d.ts +17 -0
  216. package/dist/pools/position/query.d.ts.map +1 -0
  217. package/dist/pools/position/query.js +21 -0
  218. package/dist/pools/position/query.js.map +1 -0
  219. package/dist/pools/position/sum-deposits.d.ts +10 -0
  220. package/dist/pools/position/sum-deposits.d.ts.map +1 -0
  221. package/dist/pools/position/sum-deposits.js +35 -0
  222. package/dist/pools/position/sum-deposits.js.map +1 -0
  223. package/dist/pools/profit/get-user-profit.d.ts +4 -0
  224. package/dist/pools/profit/get-user-profit.d.ts.map +1 -1
  225. package/dist/pools/profit/get-user-profit.js +18 -12
  226. package/dist/pools/profit/get-user-profit.js.map +1 -1
  227. package/dist/pools/profit/to-user-pool-profit.d.ts +22 -4
  228. package/dist/pools/profit/to-user-pool-profit.d.ts.map +1 -1
  229. package/dist/pools/profit/to-user-pool-profit.js +28 -12
  230. package/dist/pools/profit/to-user-pool-profit.js.map +1 -1
  231. package/dist/pools/quotes/get-pool-quotes.d.ts +8 -1
  232. package/dist/pools/quotes/get-pool-quotes.d.ts.map +1 -1
  233. package/dist/pools/quotes/get-pool-quotes.js +8 -1
  234. package/dist/pools/quotes/get-pool-quotes.js.map +1 -1
  235. package/dist/pools/quotes/query-document.d.ts.map +1 -1
  236. package/dist/pools/quotes/query-document.js +1 -1
  237. package/dist/pools/quotes/query-document.js.map +1 -1
  238. package/dist/pools/quotes/to-pool-quote.d.ts.map +1 -1
  239. package/dist/pools/quotes/to-pool-quote.js +13 -0
  240. package/dist/pools/quotes/to-pool-quote.js.map +1 -1
  241. package/dist/pools/rewards/query.js +25 -25
  242. package/dist/pools/statistics/calculate-pool-statistics.d.ts +69 -0
  243. package/dist/pools/statistics/calculate-pool-statistics.d.ts.map +1 -0
  244. package/dist/pools/statistics/calculate-pool-statistics.js +42 -0
  245. package/dist/pools/statistics/calculate-pool-statistics.js.map +1 -0
  246. package/dist/pools/statistics/get-pool-statistics.d.ts +29 -0
  247. package/dist/pools/statistics/get-pool-statistics.d.ts.map +1 -0
  248. package/dist/pools/statistics/get-pool-statistics.js +61 -0
  249. package/dist/pools/statistics/get-pool-statistics.js.map +1 -0
  250. package/dist/pools/statistics/index.d.ts +4 -0
  251. package/dist/pools/statistics/index.d.ts.map +1 -0
  252. package/dist/pools/statistics/query.d.ts +17 -0
  253. package/dist/pools/statistics/query.d.ts.map +1 -0
  254. package/dist/pools/statistics/query.js +21 -0
  255. package/dist/pools/statistics/query.js.map +1 -0
  256. package/dist/pools/token-metadata/get-listing-token-metadata.d.ts +32 -0
  257. package/dist/pools/token-metadata/get-listing-token-metadata.d.ts.map +1 -0
  258. package/dist/pools/token-metadata/get-listing-token-metadata.js +43 -0
  259. package/dist/pools/token-metadata/get-listing-token-metadata.js.map +1 -0
  260. package/dist/pools/token-metadata/index.d.ts +3 -0
  261. package/dist/pools/token-metadata/index.d.ts.map +1 -0
  262. package/dist/pools/token-metadata/query.d.ts +11 -0
  263. package/dist/pools/token-metadata/query.d.ts.map +1 -0
  264. package/dist/pools/token-metadata/query.js +21 -0
  265. package/dist/pools/token-metadata/query.js.map +1 -0
  266. package/dist/pools/token-support/check-listing-token-support.d.ts +23 -0
  267. package/dist/pools/token-support/check-listing-token-support.d.ts.map +1 -0
  268. package/dist/pools/token-support/check-listing-token-support.js +36 -0
  269. package/dist/pools/token-support/check-listing-token-support.js.map +1 -0
  270. package/dist/pools/token-support/index.d.ts +3 -0
  271. package/dist/pools/token-support/index.d.ts.map +1 -0
  272. package/dist/pools/token-support/query.d.ts +11 -0
  273. package/dist/pools/token-support/query.d.ts.map +1 -0
  274. package/dist/pools/token-support/query.js +21 -0
  275. package/dist/pools/token-support/query.js.map +1 -0
  276. package/dist/pools/trade-history/calculate-history-metrics.d.ts +12 -0
  277. package/dist/pools/trade-history/calculate-history-metrics.d.ts.map +1 -0
  278. package/dist/pools/trade-history/calculate-history-metrics.js +36 -0
  279. package/dist/pools/trade-history/calculate-history-metrics.js.map +1 -0
  280. package/dist/pools/trade-history/get-pool-trade-history.d.ts +21 -1
  281. package/dist/pools/trade-history/get-pool-trade-history.d.ts.map +1 -1
  282. package/dist/pools/trade-history/get-pool-trade-history.js +57 -18
  283. package/dist/pools/trade-history/get-pool-trade-history.js.map +1 -1
  284. package/dist/pools/trade-history/query-document.d.ts +3 -0
  285. package/dist/pools/trade-history/query-document.d.ts.map +1 -1
  286. package/dist/pools/trade-history/query-document.js +1 -1
  287. package/dist/pools/trade-history/query-document.js.map +1 -1
  288. package/dist/pools/transactions/get-pool-transaction-range.d.ts +6 -0
  289. package/dist/pools/transactions/get-pool-transaction-range.d.ts.map +1 -0
  290. package/dist/pools/transactions/get-pool-transaction-range.js +26 -0
  291. package/dist/pools/transactions/get-pool-transaction-range.js.map +1 -0
  292. package/dist/pools/transactions/index.d.ts +1 -0
  293. package/dist/pools/transactions/index.d.ts.map +1 -1
  294. package/dist/pools/types/generated/listing-backend.js +34 -10
  295. package/dist/pools/types/generated/listing-backend.js.map +1 -1
  296. package/dist/pools/types.d.ts +129 -6
  297. package/dist/pools/types.d.ts.map +1 -1
  298. package/dist/pools/types.js.map +1 -1
  299. package/dist/pools/user-markets/get-user-listing-markets.d.ts +2 -0
  300. package/dist/pools/user-markets/get-user-listing-markets.d.ts.map +1 -1
  301. package/dist/pools/user-markets/get-user-listing-markets.js.map +1 -1
  302. package/dist/pools/user-markets/to-user-listing-market.js +1 -1
  303. package/dist/pools/user-markets/to-user-listing-market.js.map +1 -1
  304. package/dist/pools/user-transactions/get-user-transactions.d.ts +2 -0
  305. package/dist/pools/user-transactions/get-user-transactions.d.ts.map +1 -1
  306. package/dist/pools/user-transactions/get-user-transactions.js.map +1 -1
  307. package/dist/pools/user-transactions/to-user-transaction.d.ts +5 -1
  308. package/dist/pools/user-transactions/to-user-transaction.d.ts.map +1 -1
  309. package/dist/pools/user-transactions/to-user-transaction.js +3 -0
  310. package/dist/pools/user-transactions/to-user-transaction.js.map +1 -1
  311. package/dist/quotes/get-quote-events-by-type/get-quote-events-by-type.d.ts +22 -12
  312. package/dist/quotes/get-quote-events-by-type/get-quote-events-by-type.d.ts.map +1 -1
  313. package/dist/quotes/get-quote-events-by-type/get-quote-events-by-type.js +20 -21
  314. package/dist/quotes/get-quote-events-by-type/get-quote-events-by-type.js.map +1 -1
  315. package/dist/quotes/get-quote-events-by-type/query-document.d.ts +5 -5
  316. package/dist/quotes/get-quote-events-by-type/query-document.d.ts.map +1 -1
  317. package/dist/quotes/get-quote-events-by-type/query-document.js +1 -1
  318. package/dist/quotes/get-quote-events-by-type/query-document.js.map +1 -1
  319. package/dist/quotes/get-quote-events-by-type/query.d.ts +7 -6
  320. package/dist/quotes/get-quote-events-by-type/query.d.ts.map +1 -1
  321. package/dist/quotes/get-quote-events-by-type/query.js +19 -17
  322. package/dist/quotes/get-quote-events-by-type/query.js.map +1 -1
  323. package/dist/quotes/get-quote-events-by-type/to-quote-event-row.d.ts +2 -2
  324. package/dist/quotes/get-quote-events-by-type/to-quote-event-row.d.ts.map +1 -1
  325. package/dist/quotes/get-quote-events-by-type/to-quote-event-row.js +1 -3
  326. package/dist/quotes/get-quote-events-by-type/to-quote-event-row.js.map +1 -1
  327. package/dist/quotes/get-quote-events-by-type/types.d.ts +14 -3
  328. package/dist/quotes/get-quote-events-by-type/types.d.ts.map +1 -1
  329. package/dist/quotes/get-quote-events-by-type/types.js.map +1 -1
  330. package/dist/quotes/get-quote-funding/get-quote-funding.d.ts +12 -2
  331. package/dist/quotes/get-quote-funding/get-quote-funding.d.ts.map +1 -1
  332. package/dist/quotes/get-quote-funding/get-quote-funding.js +21 -17
  333. package/dist/quotes/get-quote-funding/get-quote-funding.js.map +1 -1
  334. package/dist/quotes/get-quote-funding/query-document.d.ts +3 -2
  335. package/dist/quotes/get-quote-funding/query-document.d.ts.map +1 -1
  336. package/dist/quotes/get-quote-funding/query-document.js +1 -1
  337. package/dist/quotes/get-quote-funding/query-document.js.map +1 -1
  338. package/dist/quotes/get-quote-funding/query.d.ts.map +1 -1
  339. package/dist/quotes/get-quote-funding/query.js +2 -1
  340. package/dist/quotes/get-quote-funding/query.js.map +1 -1
  341. package/dist/quotes/get-quote-funding/to-funding-row.d.ts.map +1 -1
  342. package/dist/quotes/get-quote-funding/to-funding-row.js +1 -3
  343. package/dist/quotes/get-quote-funding/to-funding-row.js.map +1 -1
  344. package/dist/quotes/get-quote-history/get-quote-history.d.ts +18 -7
  345. package/dist/quotes/get-quote-history/get-quote-history.d.ts.map +1 -1
  346. package/dist/quotes/get-quote-history/get-quote-history.js +32 -22
  347. package/dist/quotes/get-quote-history/get-quote-history.js.map +1 -1
  348. package/dist/quotes/get-quote-history/query-document.d.ts +12 -7
  349. package/dist/quotes/get-quote-history/query-document.d.ts.map +1 -1
  350. package/dist/quotes/get-quote-history/query-document.js +1 -1
  351. package/dist/quotes/get-quote-history/query-document.js.map +1 -1
  352. package/dist/quotes/get-quote-history/query.d.ts +3 -2
  353. package/dist/quotes/get-quote-history/query.d.ts.map +1 -1
  354. package/dist/quotes/get-quote-history/query.js +22 -19
  355. package/dist/quotes/get-quote-history/query.js.map +1 -1
  356. package/dist/quotes/get-quote-history/to-history-row.d.ts.map +1 -1
  357. package/dist/quotes/get-quote-history/to-history-row.js +52 -37
  358. package/dist/quotes/get-quote-history/to-history-row.js.map +1 -1
  359. package/dist/quotes/get-quote-history/types.d.ts +41 -0
  360. package/dist/quotes/get-quote-history/types.d.ts.map +1 -1
  361. package/dist/quotes/get-quote-history/types.js.map +1 -1
  362. package/dist/quotes/get-quotes-events-by-type/get-quotes-events-by-type.d.ts +21 -11
  363. package/dist/quotes/get-quotes-events-by-type/get-quotes-events-by-type.d.ts.map +1 -1
  364. package/dist/quotes/get-quotes-events-by-type/get-quotes-events-by-type.js +19 -21
  365. package/dist/quotes/get-quotes-events-by-type/get-quotes-events-by-type.js.map +1 -1
  366. package/dist/quotes/get-quotes-events-by-type/query-document.d.ts +7 -7
  367. package/dist/quotes/get-quotes-events-by-type/query-document.d.ts.map +1 -1
  368. package/dist/quotes/get-quotes-events-by-type/query-document.js +1 -1
  369. package/dist/quotes/get-quotes-events-by-type/query-document.js.map +1 -1
  370. package/dist/quotes/get-quotes-events-by-type/query.d.ts +8 -6
  371. package/dist/quotes/get-quotes-events-by-type/query.d.ts.map +1 -1
  372. package/dist/quotes/get-quotes-events-by-type/query.js +22 -20
  373. package/dist/quotes/get-quotes-events-by-type/query.js.map +1 -1
  374. package/dist/quotes/get-subgraph-quotes/get-subgraph-quotes.d.ts +38 -0
  375. package/dist/quotes/get-subgraph-quotes/get-subgraph-quotes.d.ts.map +1 -0
  376. package/dist/quotes/get-subgraph-quotes/get-subgraph-quotes.js +28 -0
  377. package/dist/quotes/get-subgraph-quotes/get-subgraph-quotes.js.map +1 -0
  378. package/dist/quotes/get-subgraph-quotes/index.d.ts +5 -0
  379. package/dist/quotes/get-subgraph-quotes/index.d.ts.map +1 -0
  380. package/dist/quotes/get-subgraph-quotes/query-document.d.ts +15 -0
  381. package/dist/quotes/get-subgraph-quotes/query-document.d.ts.map +1 -0
  382. package/dist/quotes/get-subgraph-quotes/query-document.js +7 -0
  383. package/dist/quotes/get-subgraph-quotes/query-document.js.map +1 -0
  384. package/dist/quotes/get-subgraph-quotes/query.d.ts +37 -0
  385. package/dist/quotes/get-subgraph-quotes/query.d.ts.map +1 -0
  386. package/dist/quotes/get-subgraph-quotes/query.js +23 -0
  387. package/dist/quotes/get-subgraph-quotes/query.js.map +1 -0
  388. package/dist/quotes/get-subgraph-quotes/to-subgraph-quote-row.d.ts +12 -0
  389. package/dist/quotes/get-subgraph-quotes/to-subgraph-quote-row.d.ts.map +1 -0
  390. package/dist/quotes/get-subgraph-quotes/to-subgraph-quote-row.js +32 -0
  391. package/dist/quotes/get-subgraph-quotes/to-subgraph-quote-row.js.map +1 -0
  392. package/dist/quotes/get-subgraph-quotes/types.d.ts +54 -0
  393. package/dist/quotes/get-subgraph-quotes/types.d.ts.map +1 -0
  394. package/dist/quotes/index.d.ts +1 -0
  395. package/dist/quotes/index.d.ts.map +1 -1
  396. package/dist/quotes/liquidation/calculate-liquidation-price.d.ts +5 -1
  397. package/dist/quotes/liquidation/calculate-liquidation-price.d.ts.map +1 -1
  398. package/dist/quotes/liquidation/calculate-liquidation-price.js +1 -1
  399. package/dist/quotes/liquidation/calculate-liquidation-price.js.map +1 -1
  400. package/dist/quotes/upnl/calculate-quote-pnl.d.ts.map +1 -1
  401. package/dist/quotes/upnl/calculate-quote-pnl.js +8 -8
  402. package/dist/quotes/upnl/calculate-quote-pnl.js.map +1 -1
  403. package/dist/quotes/upnl/calculate-quote-upnl.d.ts +2 -2
  404. package/dist/quotes/upnl/calculate-quote-upnl.d.ts.map +1 -1
  405. package/dist/quotes/upnl/calculate-quote-upnl.js +16 -15
  406. package/dist/quotes/upnl/calculate-quote-upnl.js.map +1 -1
  407. package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/get-party-a-open-positions-batch.d.ts +122 -0
  408. package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/get-party-a-open-positions-batch.d.ts.map +1 -0
  409. package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/get-party-a-open-positions-batch.js +80 -0
  410. package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/get-party-a-open-positions-batch.js.map +1 -0
  411. package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/index.d.ts +3 -0
  412. package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/index.d.ts.map +1 -0
  413. package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/query.d.ts +37 -0
  414. package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/query.d.ts.map +1 -0
  415. package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/query.js +27 -0
  416. package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/query.js.map +1 -0
  417. package/dist/symmio-contracts/symmio/index.d.ts +2 -0
  418. package/dist/symmio-contracts/symmio/index.d.ts.map +1 -1
  419. package/dist/symmio-contracts/symmio/is-party-a-liquidated/index.d.ts +3 -0
  420. package/dist/symmio-contracts/symmio/is-party-a-liquidated/index.d.ts.map +1 -0
  421. package/dist/symmio-contracts/symmio/is-party-a-liquidated/is-party-a-liquidated.d.ts +37 -0
  422. package/dist/symmio-contracts/symmio/is-party-a-liquidated/is-party-a-liquidated.d.ts.map +1 -0
  423. package/dist/symmio-contracts/symmio/is-party-a-liquidated/is-party-a-liquidated.js +15 -0
  424. package/dist/symmio-contracts/symmio/is-party-a-liquidated/is-party-a-liquidated.js.map +1 -0
  425. package/dist/symmio-contracts/symmio/is-party-a-liquidated/query.d.ts +38 -0
  426. package/dist/symmio-contracts/symmio/is-party-a-liquidated/query.d.ts.map +1 -0
  427. package/dist/symmio-contracts/symmio/is-party-a-liquidated/query.js +29 -0
  428. package/dist/symmio-contracts/symmio/is-party-a-liquidated/query.js.map +1 -0
  429. package/dist/symmio-subgraph/index.d.ts +1 -0
  430. package/dist/symmio-subgraph/index.d.ts.map +1 -1
  431. package/dist/symmio-subgraph/subgraph-decode.d.ts +51 -0
  432. package/dist/symmio-subgraph/subgraph-decode.d.ts.map +1 -0
  433. package/dist/symmio-subgraph/subgraph-decode.js +24 -0
  434. package/dist/symmio-subgraph/subgraph-decode.js.map +1 -0
  435. package/dist/symmio-subgraph/subgraph-filters.d.ts +97 -0
  436. package/dist/symmio-subgraph/subgraph-filters.d.ts.map +1 -0
  437. package/dist/symmio-subgraph/subgraph-filters.js +39 -0
  438. package/dist/symmio-subgraph/subgraph-filters.js.map +1 -0
  439. package/dist/symmio-subgraph/types/generated/analytics/gql.d.ts +26 -6
  440. package/dist/symmio-subgraph/types/generated/analytics/gql.d.ts.map +1 -1
  441. package/dist/symmio-subgraph/types/generated/analytics/gql.js +16 -11
  442. package/dist/symmio-subgraph/types/generated/analytics/gql.js.map +1 -1
  443. package/dist/symmio-subgraph/types/generated/analytics/graphql.d.ts +3661 -9
  444. package/dist/symmio-subgraph/types/generated/analytics/graphql.d.ts.map +1 -1
  445. package/dist/symmio-subgraph/types/generated/analytics/graphql.js +2 -2
  446. package/dist/symmio-subgraph/types/generated/analytics/graphql.js.map +1 -1
  447. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"query-document.js","names":[],"sources":["../../../src/quotes/get-quote-events-by-type/query-document.ts"],"sourcesContent":["import { graphql } from \"../../symmio-subgraph/types/generated/analytics\";\n\n/**\n * Read every `QuoteEvent` of the requested types for one quote id, paginated and\n * sorted by `timestamp`. Filter by the protocol-level `quoteId` scalar so callers\n * never need the diamond address. Caller decodes `metadata` per row.\n */\nexport const QuoteEventsForQuoteByTypeDocument = graphql(`\n query QuoteEventsForQuoteByType(\n $quoteId: BigInt!\n $typeIn: [String!]!\n $first: Int!\n $skip: Int!\n $orderDirection: OrderDirection!\n ) {\n quoteEvents(\n first: $first\n skip: $skip\n orderBy: timestamp\n orderDirection: $orderDirection\n where: { quoteId: $quoteId, type_in: $typeIn }\n ) {\n id\n type\n metadata\n timestamp\n blockNumber\n transaction\n quoteId\n }\n }\n`);\n"],"mappings":";;AAOA,IAAa,IAAoC,EAAQ,0dAwBxD"}
1
+ {"version":3,"file":"query-document.js","names":[],"sources":["../../../src/quotes/get-quote-events-by-type/query-document.ts"],"sourcesContent":["import { graphql } from \"../../symmio-subgraph/types/generated/analytics\";\n\n/**\n * Read `QuoteEvent`s for one quote id, paginated and sorted by `timestamp`.\n * Filter by the protocol-level `quoteId` scalar so callers never need the diamond\n * address. The action builds `$where`: `quoteId` always, `type_in` and `source`\n * only when passed. Caller decodes `metadata` per row.\n */\nexport const QuoteEventsForQuoteByTypeDocument = graphql(`\n query QuoteEventsForQuoteByType(\n $where: QuoteEvent_filter!\n $first: Int!\n $skip: Int!\n $orderDirection: OrderDirection!\n ) {\n quoteEvents(first: $first, skip: $skip, orderBy: timestamp, orderDirection: $orderDirection, where: $where) {\n id\n type\n metadata\n timestamp\n blockNumber\n transaction\n quoteId\n }\n }\n`);\n"],"mappings":";;AAQA,IAAa,IAAoC,EAAQ,mYAiBxD"}
@@ -2,8 +2,9 @@ import { Config } from '../../core/config/index.js';
2
2
  import { Compute, ConfigKeyParameter } from '../../shared/types/properties.js';
3
3
  import { QueryParameter, SymmioQueryOptions } from '../../shared/types/query.js';
4
4
  import { GetQuoteEventsByTypeParameters, GetQuoteEventsByTypeReturnType } from './get-quote-events-by-type.js';
5
+ import { QuoteEventType, QuoteSubgraphEventType } from './types.js';
5
6
  /** Data resolved by the {@link getQuoteEventsByTypeQueryOptions} query. */
6
- export type GetQuoteEventsByTypeData = GetQuoteEventsByTypeReturnType;
7
+ export type GetQuoteEventsByTypeData<TType extends QuoteSubgraphEventType = QuoteEventType> = GetQuoteEventsByTypeReturnType<TType>;
7
8
  /**
8
9
  * Build the TanStack Query key for {@link getQuoteEventsByTypeQueryOptions}.
9
10
  *
@@ -12,8 +13,8 @@ export type GetQuoteEventsByTypeData = GetQuoteEventsByTypeReturnType;
12
13
  * the key is JSON-safe.
13
14
  */
14
15
  export declare function getQuoteEventsByTypeQueryKey(options: Compute<GetQuoteEventsByTypeParameters & ConfigKeyParameter>): readonly ["getQuoteEventsByType", {
16
+ readonly types?: QuoteSubgraphEventType[] | undefined;
15
17
  readonly quoteId: string;
16
- readonly types: readonly import('./types.js').QuoteEventType[];
17
18
  }];
18
19
  /** Query-key type produced by {@link getQuoteEventsByTypeQueryKey}. */
19
20
  export type GetQuoteEventsByTypeQueryKey = ReturnType<typeof getQuoteEventsByTypeQueryKey>;
@@ -21,12 +22,12 @@ export type GetQuoteEventsByTypeQueryKey = ReturnType<typeof getQuoteEventsByTyp
21
22
  * Options accepted by {@link getQuoteEventsByTypeQueryOptions}: the action's
22
23
  * parameters plus TanStack overrides.
23
24
  */
24
- export type GetQuoteEventsByTypeOptions = Compute<GetQuoteEventsByTypeParameters & QueryParameter<GetQuoteEventsByTypeData, Error, GetQuoteEventsByTypeData, GetQuoteEventsByTypeQueryKey>>;
25
+ export type GetQuoteEventsByTypeOptions<TType extends QuoteSubgraphEventType = QuoteSubgraphEventType> = Compute<GetQuoteEventsByTypeParameters<TType> & QueryParameter<GetQuoteEventsByTypeData<TType>, Error, GetQuoteEventsByTypeData<TType>, GetQuoteEventsByTypeQueryKey>>;
25
26
  /** TanStack Query options returned by {@link getQuoteEventsByTypeQueryOptions}. */
26
- export type GetQuoteEventsByTypeQueryOptions = SymmioQueryOptions<GetQuoteEventsByTypeData, Error, GetQuoteEventsByTypeData, GetQuoteEventsByTypeQueryKey>;
27
+ export type GetQuoteEventsByTypeQueryOptions<TType extends QuoteSubgraphEventType = QuoteEventType> = SymmioQueryOptions<GetQuoteEventsByTypeData<TType>, Error, GetQuoteEventsByTypeData<TType>, GetQuoteEventsByTypeQueryKey>;
27
28
  /**
28
29
  * Build TanStack Query options for {@link getQuoteEventsByType}. The query is
29
- * disabled until at least one event type is supplied.
30
+ * disabled while `types` is an empty array; omitting `types` reads every type.
30
31
  *
31
32
  * @param config - The SDK config.
32
33
  * @param options - Query parameters and TanStack overrides.
@@ -39,5 +40,5 @@ export type GetQuoteEventsByTypeQueryOptions = SymmioQueryOptions<GetQuoteEvents
39
40
  * );
40
41
  * ```
41
42
  */
42
- export declare function getQuoteEventsByTypeQueryOptions(config: Config, options: GetQuoteEventsByTypeOptions): GetQuoteEventsByTypeQueryOptions;
43
+ export declare function getQuoteEventsByTypeQueryOptions<TType extends QuoteSubgraphEventType = QuoteSubgraphEventType>(config: Config, options: GetQuoteEventsByTypeOptions<TType>): GetQuoteEventsByTypeQueryOptions<TType>;
43
44
  //# sourceMappingURL=query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quote-events-by-type/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnF,OAAO,EAEL,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACpC,MAAM,4BAA4B,CAAC;AAEpC,2EAA2E;AAC3E,MAAM,MAAM,wBAAwB,GAAG,8BAA8B,CAAC;AAEtE;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,OAAO,CAAC,8BAA8B,GAAG,kBAAkB,CAAC;;;GAMjH;AAED,uEAAuE;AACvE,MAAM,MAAM,4BAA4B,GAAG,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAE3F;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GAAG,OAAO,CAC/C,8BAA8B,GAC5B,cAAc,CAAC,wBAAwB,EAAE,KAAK,EAAE,wBAAwB,EAAE,4BAA4B,CAAC,CAC1G,CAAC;AAEF,mFAAmF;AACnF,MAAM,MAAM,gCAAgC,GAAG,kBAAkB,CAC/D,wBAAwB,EACxB,KAAK,EACL,wBAAwB,EACxB,4BAA4B,CAC7B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,2BAA2B,GACnC,gCAAgC,CAkBlC"}
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quote-events-by-type/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAGnF,OAAO,EAEL,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACpC,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtE,2EAA2E;AAC3E,MAAM,MAAM,wBAAwB,CAAC,KAAK,SAAS,sBAAsB,GAAG,cAAc,IACxF,8BAA8B,CAAC,KAAK,CAAC,CAAC;AAExC;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,OAAO,CAAC,8BAA8B,GAAG,kBAAkB,CAAC;;;GAUjH;AAED,uEAAuE;AACvE,MAAM,MAAM,4BAA4B,GAAG,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAE3F;;;GAGG;AACH,MAAM,MAAM,2BAA2B,CAAC,KAAK,SAAS,sBAAsB,GAAG,sBAAsB,IAAI,OAAO,CAC9G,8BAA8B,CAAC,KAAK,CAAC,GACnC,cAAc,CACZ,wBAAwB,CAAC,KAAK,CAAC,EAC/B,KAAK,EACL,wBAAwB,CAAC,KAAK,CAAC,EAC/B,4BAA4B,CAC7B,CACJ,CAAC;AAEF,mFAAmF;AACnF,MAAM,MAAM,gCAAgC,CAAC,KAAK,SAAS,sBAAsB,GAAG,cAAc,IAChG,kBAAkB,CAChB,wBAAwB,CAAC,KAAK,CAAC,EAC/B,KAAK,EACL,wBAAwB,CAAC,KAAK,CAAC,EAC/B,4BAA4B,CAC7B,CAAC;AAEJ;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gCAAgC,CAAC,KAAK,SAAS,sBAAsB,GAAG,sBAAsB,EAC5G,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAC1C,gCAAgC,CAAC,KAAK,CAAC,CAmBzC"}
@@ -1,32 +1,34 @@
1
1
  import { filterQueryOptions as e } from "../../shared/utils/query.js";
2
- import { getQuoteEventsByType as t } from "./get-quote-events-by-type.js";
2
+ import { hasEmptyListFilter as t } from "../../symmio-subgraph/subgraph-filters.js";
3
+ import { getQuoteEventsByType as n } from "./get-quote-events-by-type.js";
3
4
  //#region src/quotes/get-quote-events-by-type/query.ts
4
- function n(t) {
5
+ function r(t) {
5
6
  return ["getQuoteEventsByType", {
6
7
  ...e(t),
7
8
  quoteId: t.quoteId.toString(),
8
- types: [...t.types]
9
+ ...t.types === void 0 ? {} : { types: [...t.types] }
9
10
  }];
10
11
  }
11
- function r(e, r) {
12
+ function i(e, i) {
12
13
  return {
13
- ...r.query,
14
- queryKey: n({
15
- ...r,
16
- configKey: e.getChainConfigKey(r.chainId)
14
+ ...i.query,
15
+ queryKey: r({
16
+ ...i,
17
+ configKey: e.getChainConfigKey(i.chainId)
17
18
  }),
18
- enabled: (r.query?.enabled ?? !0) && r.types.length > 0,
19
- queryFn: () => t(e, {
20
- chainId: r.chainId,
21
- quoteId: r.quoteId,
22
- types: r.types,
23
- first: r.first,
24
- skip: r.skip,
25
- orderDirection: r.orderDirection
19
+ enabled: (i.query?.enabled ?? !0) && !t(i.types),
20
+ queryFn: () => n(e, {
21
+ chainId: i.chainId,
22
+ quoteId: i.quoteId,
23
+ types: i.types,
24
+ source: i.source,
25
+ first: i.first,
26
+ skip: i.skip,
27
+ orderDirection: i.orderDirection
26
28
  })
27
29
  };
28
30
  }
29
31
  //#endregion
30
- export { n as getQuoteEventsByTypeQueryKey, r as getQuoteEventsByTypeQueryOptions };
32
+ export { r as getQuoteEventsByTypeQueryKey, i as getQuoteEventsByTypeQueryOptions };
31
33
 
32
34
  //# sourceMappingURL=query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.js","names":[],"sources":["../../../src/quotes/get-quote-events-by-type/query.ts"],"sourcesContent":["import type { Config } from \"../../core/config\";\nimport type { Compute, ConfigKeyParameter } from \"../../shared/types/properties\";\nimport type { QueryParameter, SymmioQueryOptions } from \"../../shared/types/query\";\nimport { filterQueryOptions } from \"../../shared/utils/query\";\nimport {\n getQuoteEventsByType,\n type GetQuoteEventsByTypeParameters,\n type GetQuoteEventsByTypeReturnType,\n} from \"./get-quote-events-by-type\";\n\n/** Data resolved by the {@link getQuoteEventsByTypeQueryOptions} query. */\nexport type GetQuoteEventsByTypeData = GetQuoteEventsByTypeReturnType;\n\n/**\n * Build the TanStack Query key for {@link getQuoteEventsByTypeQueryOptions}.\n *\n * @param options - Query parameters (quote id, types, paging, sort, chain id, config key).\n * @returns A stable, hashable query key. The `bigint` quote id is stringified so\n * the key is JSON-safe.\n */\nexport function getQuoteEventsByTypeQueryKey(options: Compute<GetQuoteEventsByTypeParameters & ConfigKeyParameter>) {\n const filtered = filterQueryOptions(options);\n return [\n \"getQuoteEventsByType\",\n { ...filtered, quoteId: options.quoteId.toString(), types: [...options.types] },\n ] as const;\n}\n\n/** Query-key type produced by {@link getQuoteEventsByTypeQueryKey}. */\nexport type GetQuoteEventsByTypeQueryKey = ReturnType<typeof getQuoteEventsByTypeQueryKey>;\n\n/**\n * Options accepted by {@link getQuoteEventsByTypeQueryOptions}: the action's\n * parameters plus TanStack overrides.\n */\nexport type GetQuoteEventsByTypeOptions = Compute<\n GetQuoteEventsByTypeParameters &\n QueryParameter<GetQuoteEventsByTypeData, Error, GetQuoteEventsByTypeData, GetQuoteEventsByTypeQueryKey>\n>;\n\n/** TanStack Query options returned by {@link getQuoteEventsByTypeQueryOptions}. */\nexport type GetQuoteEventsByTypeQueryOptions = SymmioQueryOptions<\n GetQuoteEventsByTypeData,\n Error,\n GetQuoteEventsByTypeData,\n GetQuoteEventsByTypeQueryKey\n>;\n\n/**\n * Build TanStack Query options for {@link getQuoteEventsByType}. The query is\n * disabled until at least one event type is supplied.\n *\n * @param config - The SDK config.\n * @param options - Query parameters and TanStack overrides.\n * @returns Options to pass to `useQuery` / `queryClient.fetchQuery`.\n *\n * @example\n * ```ts\n * useQuery(\n * getQuoteEventsByTypeQueryOptions(config, { quoteId: 7334n, types: PRICE_HISTORY_EVENT_TYPES }),\n * );\n * ```\n */\nexport function getQuoteEventsByTypeQueryOptions(\n config: Config,\n options: GetQuoteEventsByTypeOptions,\n): GetQuoteEventsByTypeQueryOptions {\n return {\n ...options.query,\n queryKey: getQuoteEventsByTypeQueryKey({\n ...options,\n configKey: config.getChainConfigKey(options.chainId),\n }),\n enabled: (options.query?.enabled ?? true) && options.types.length > 0,\n queryFn: () =>\n getQuoteEventsByType(config, {\n chainId: options.chainId,\n quoteId: options.quoteId,\n types: options.types,\n first: options.first,\n skip: options.skip,\n orderDirection: options.orderDirection,\n }),\n };\n}\n"],"mappings":";;;AAoBA,SAAgB,EAA6B,GAAuE;CAElH,OAAO,CACL,wBACA;EAAE,GAHa,EAAmB,CAG7B;EAAU,SAAS,EAAQ,QAAQ,SAAS;EAAG,OAAO,CAAC,GAAG,EAAQ,KAAK;CAAE,CAChF;AACF;AAqCA,SAAgB,EACd,GACA,GACkC;CAClC,OAAO;EACL,GAAG,EAAQ;EACX,UAAU,EAA6B;GACrC,GAAG;GACH,WAAW,EAAO,kBAAkB,EAAQ,OAAO;EACrD,CAAC;EACD,UAAU,EAAQ,OAAO,WAAW,OAAS,EAAQ,MAAM,SAAS;EACpE,eACE,EAAqB,GAAQ;GAC3B,SAAS,EAAQ;GACjB,SAAS,EAAQ;GACjB,OAAO,EAAQ;GACf,OAAO,EAAQ;GACf,MAAM,EAAQ;GACd,gBAAgB,EAAQ;EAC1B,CAAC;CACL;AACF"}
1
+ {"version":3,"file":"query.js","names":[],"sources":["../../../src/quotes/get-quote-events-by-type/query.ts"],"sourcesContent":["import type { Config } from \"../../core/config\";\nimport type { Compute, ConfigKeyParameter } from \"../../shared/types/properties\";\nimport type { QueryParameter, SymmioQueryOptions } from \"../../shared/types/query\";\nimport { filterQueryOptions } from \"../../shared/utils/query\";\nimport { hasEmptyListFilter } from \"../../symmio-subgraph/subgraph-filters\";\nimport {\n getQuoteEventsByType,\n type GetQuoteEventsByTypeParameters,\n type GetQuoteEventsByTypeReturnType,\n} from \"./get-quote-events-by-type\";\nimport type { QuoteEventType, QuoteSubgraphEventType } from \"./types\";\n\n/** Data resolved by the {@link getQuoteEventsByTypeQueryOptions} query. */\nexport type GetQuoteEventsByTypeData<TType extends QuoteSubgraphEventType = QuoteEventType> =\n GetQuoteEventsByTypeReturnType<TType>;\n\n/**\n * Build the TanStack Query key for {@link getQuoteEventsByTypeQueryOptions}.\n *\n * @param options - Query parameters (quote id, types, paging, sort, chain id, config key).\n * @returns A stable, hashable query key. The `bigint` quote id is stringified so\n * the key is JSON-safe.\n */\nexport function getQuoteEventsByTypeQueryKey(options: Compute<GetQuoteEventsByTypeParameters & ConfigKeyParameter>) {\n const filtered = filterQueryOptions(options);\n return [\n \"getQuoteEventsByType\",\n {\n ...filtered,\n quoteId: options.quoteId.toString(),\n ...(options.types === undefined ? {} : { types: [...options.types] }),\n },\n ] as const;\n}\n\n/** Query-key type produced by {@link getQuoteEventsByTypeQueryKey}. */\nexport type GetQuoteEventsByTypeQueryKey = ReturnType<typeof getQuoteEventsByTypeQueryKey>;\n\n/**\n * Options accepted by {@link getQuoteEventsByTypeQueryOptions}: the action's\n * parameters plus TanStack overrides.\n */\nexport type GetQuoteEventsByTypeOptions<TType extends QuoteSubgraphEventType = QuoteSubgraphEventType> = Compute<\n GetQuoteEventsByTypeParameters<TType> &\n QueryParameter<\n GetQuoteEventsByTypeData<TType>,\n Error,\n GetQuoteEventsByTypeData<TType>,\n GetQuoteEventsByTypeQueryKey\n >\n>;\n\n/** TanStack Query options returned by {@link getQuoteEventsByTypeQueryOptions}. */\nexport type GetQuoteEventsByTypeQueryOptions<TType extends QuoteSubgraphEventType = QuoteEventType> =\n SymmioQueryOptions<\n GetQuoteEventsByTypeData<TType>,\n Error,\n GetQuoteEventsByTypeData<TType>,\n GetQuoteEventsByTypeQueryKey\n >;\n\n/**\n * Build TanStack Query options for {@link getQuoteEventsByType}. The query is\n * disabled while `types` is an empty array; omitting `types` reads every type.\n *\n * @param config - The SDK config.\n * @param options - Query parameters and TanStack overrides.\n * @returns Options to pass to `useQuery` / `queryClient.fetchQuery`.\n *\n * @example\n * ```ts\n * useQuery(\n * getQuoteEventsByTypeQueryOptions(config, { quoteId: 7334n, types: PRICE_HISTORY_EVENT_TYPES }),\n * );\n * ```\n */\nexport function getQuoteEventsByTypeQueryOptions<TType extends QuoteSubgraphEventType = QuoteSubgraphEventType>(\n config: Config,\n options: GetQuoteEventsByTypeOptions<TType>,\n): GetQuoteEventsByTypeQueryOptions<TType> {\n return {\n ...options.query,\n queryKey: getQuoteEventsByTypeQueryKey({\n ...options,\n configKey: config.getChainConfigKey(options.chainId),\n }),\n enabled: (options.query?.enabled ?? true) && !hasEmptyListFilter(options.types),\n queryFn: () =>\n getQuoteEventsByType<TType>(config, {\n chainId: options.chainId,\n quoteId: options.quoteId,\n types: options.types,\n source: options.source,\n first: options.first,\n skip: options.skip,\n orderDirection: options.orderDirection,\n }),\n };\n}\n"],"mappings":";;;;AAuBA,SAAgB,EAA6B,GAAuE;CAElH,OAAO,CACL,wBACA;EACE,GAJa,EAAmB,CAI7B;EACH,SAAS,EAAQ,QAAQ,SAAS;EAClC,GAAI,EAAQ,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,EAAQ,KAAK,EAAE;CACrE,CACF;AACF;AA2CA,SAAgB,EACd,GACA,GACyC;CACzC,OAAO;EACL,GAAG,EAAQ;EACX,UAAU,EAA6B;GACrC,GAAG;GACH,WAAW,EAAO,kBAAkB,EAAQ,OAAO;EACrD,CAAC;EACD,UAAU,EAAQ,OAAO,WAAW,OAAS,CAAC,EAAmB,EAAQ,KAAK;EAC9E,eACE,EAA4B,GAAQ;GAClC,SAAS,EAAQ;GACjB,SAAS,EAAQ;GACjB,OAAO,EAAQ;GACf,QAAQ,EAAQ;GAChB,OAAO,EAAQ;GACf,MAAM,EAAQ;GACd,gBAAgB,EAAQ;EAC1B,CAAC;CACL;AACF"}
@@ -1,5 +1,5 @@
1
1
  import { QuoteEventsForQuoteByTypeQuery } from '../../symmio-subgraph/types/generated/analytics/graphql.js';
2
- import { QuoteEventRow } from './types.js';
2
+ import { QuoteEventRow, QuoteEventType, QuoteSubgraphEventType } from './types.js';
3
3
  /** A single `quoteEvents` row as returned by the events query. */
4
4
  export type RawQuoteEventNode = QuoteEventsForQuoteByTypeQuery["quoteEvents"][number];
5
5
  /**
@@ -7,5 +7,5 @@ export type RawQuoteEventNode = QuoteEventsForQuoteByTypeQuery["quoteEvents"][nu
7
7
  * `metadata` JSON varies per event type — every recognized field is decoded and
8
8
  * placed on the typed row; missing fields stay `undefined`.
9
9
  */
10
- export declare function toQuoteEventRow(row: RawQuoteEventNode): QuoteEventRow;
10
+ export declare function toQuoteEventRow<TType extends QuoteSubgraphEventType = QuoteEventType>(row: RawQuoteEventNode): QuoteEventRow<TType>;
11
11
  //# sourceMappingURL=to-quote-event-row.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-quote-event-row.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quote-events-by-type/to-quote-event-row.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,yDAAyD,CAAC;AAC9G,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7D,kEAAkE;AAClE,MAAM,MAAM,iBAAiB,GAAG,8BAA8B,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AA6BtF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,iBAAiB,GAAG,aAAa,CAiBrE"}
1
+ {"version":3,"file":"to-quote-event-row.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quote-events-by-type/to-quote-event-row.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,yDAAyD,CAAC;AAC9G,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAErF,kEAAkE;AAClE,MAAM,MAAM,iBAAiB,GAAG,8BAA8B,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAwBtF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,SAAS,sBAAsB,GAAG,cAAc,EACnF,GAAG,EAAE,iBAAiB,GACrB,aAAa,CAAC,KAAK,CAAC,CAiBtB"}
@@ -1,7 +1,5 @@
1
+ import { toBigIntOrZero as e } from "../../symmio-subgraph/subgraph-decode.js";
1
2
  //#region src/quotes/get-quote-events-by-type/to-quote-event-row.ts
2
- function e(e) {
3
- return e ? BigInt(e) : 0n;
4
- }
5
3
  function t(e) {
6
4
  if (e == null) return;
7
5
  let t = String(e).trim();
@@ -1 +1 @@
1
- {"version":3,"file":"to-quote-event-row.js","names":[],"sources":["../../../src/quotes/get-quote-events-by-type/to-quote-event-row.ts"],"sourcesContent":["import type { Hex } from \"viem\";\nimport type { QuoteEventsForQuoteByTypeQuery } from \"../../symmio-subgraph/types/generated/analytics/graphql\";\nimport { QuoteEventType, type QuoteEventRow } from \"./types\";\n\n/** A single `quoteEvents` row as returned by the events query. */\nexport type RawQuoteEventNode = QuoteEventsForQuoteByTypeQuery[\"quoteEvents\"][number];\n\n/** Parse a wei string to `bigint`, defaulting null/undefined to `0n`. */\nfunction toBigInt(value: string | null | undefined): bigint {\n return value ? BigInt(value) : 0n;\n}\n\n/** Read a wei field from the metadata snapshot as a `bigint`, or `undefined` when absent / unparsable. */\nfunction optionalWei(value: unknown): bigint | undefined {\n if (value === undefined || value === null) return undefined;\n const text = String(value).trim();\n if (text === \"\") return undefined;\n try {\n return BigInt(text);\n } catch {\n return undefined;\n }\n}\n\n/** Parse the event `metadata` JSON, returning `null` on absence or malformed input. */\nfunction parseMetadata(raw: string | null): Record<string, unknown> | null {\n if (!raw) return null;\n try {\n return JSON.parse(raw) as Record<string, unknown>;\n } catch {\n return null;\n }\n}\n\n/**\n * Decode one raw subgraph `QuoteEvent` row into a {@link QuoteEventRow}. The\n * `metadata` JSON varies per event type — every recognized field is decoded and\n * placed on the typed row; missing fields stay `undefined`.\n */\nexport function toQuoteEventRow(row: RawQuoteEventNode): QuoteEventRow {\n const metadata = parseMetadata(row.metadata);\n return {\n eventId: row.id,\n quoteId: toBigInt(row.quoteId),\n type: row.type as QuoteEventType,\n timestamp: Number(row.timestamp),\n blockNumber: row.blockNumber ? BigInt(row.blockNumber) : undefined,\n transaction: row.transaction ? (row.transaction as Hex) : undefined,\n newPrice: metadata ? optionalWei(metadata.newPrice) : undefined,\n prevPrice: metadata ? optionalWei(metadata.prevPrice) : undefined,\n openQuantity: metadata ? optionalWei(metadata.openQuantity) : undefined,\n fundingPaid: metadata ? optionalWei(metadata.fundingPaid) : undefined,\n fundingReceived: metadata ? optionalWei(metadata.fundingReceived) : undefined,\n rate: metadata ? optionalWei(metadata.rate) : undefined,\n rawMetadata: row.metadata,\n };\n}\n"],"mappings":";AAQA,SAAS,EAAS,GAA0C;CAC1D,OAAO,IAAQ,OAAO,CAAK,IAAI;AACjC;AAGA,SAAS,EAAY,GAAoC;CACvD,IAAI,KAAiC,MAAM;CAC3C,IAAM,IAAO,OAAO,CAAK,EAAE,KAAK;CAC5B,UAAS,IACb,IAAI;EACF,OAAO,OAAO,CAAI;CACpB,QAAQ;EACN;CACF;AACF;AAGA,SAAS,EAAc,GAAoD;CACzE,IAAI,CAAC,GAAK,OAAO;CACjB,IAAI;EACF,OAAO,KAAK,MAAM,CAAG;CACvB,QAAQ;EACN,OAAO;CACT;AACF;AAOA,SAAgB,EAAgB,GAAuC;CACrE,IAAM,IAAW,EAAc,EAAI,QAAQ;CAC3C,OAAO;EACL,SAAS,EAAI;EACb,SAAS,EAAS,EAAI,OAAO;EAC7B,MAAM,EAAI;EACV,WAAW,OAAO,EAAI,SAAS;EAC/B,aAAa,EAAI,cAAc,OAAO,EAAI,WAAW,IAAI,KAAA;EACzD,aAAa,EAAI,cAAe,EAAI,cAAsB,KAAA;EAC1D,UAAU,IAAW,EAAY,EAAS,QAAQ,IAAI,KAAA;EACtD,WAAW,IAAW,EAAY,EAAS,SAAS,IAAI,KAAA;EACxD,cAAc,IAAW,EAAY,EAAS,YAAY,IAAI,KAAA;EAC9D,aAAa,IAAW,EAAY,EAAS,WAAW,IAAI,KAAA;EAC5D,iBAAiB,IAAW,EAAY,EAAS,eAAe,IAAI,KAAA;EACpE,MAAM,IAAW,EAAY,EAAS,IAAI,IAAI,KAAA;EAC9C,aAAa,EAAI;CACnB;AACF"}
1
+ {"version":3,"file":"to-quote-event-row.js","names":[],"sources":["../../../src/quotes/get-quote-events-by-type/to-quote-event-row.ts"],"sourcesContent":["import type { Hex } from \"viem\";\nimport { toBigIntOrZero } from \"../../symmio-subgraph/subgraph-decode\";\nimport type { QuoteEventsForQuoteByTypeQuery } from \"../../symmio-subgraph/types/generated/analytics/graphql\";\nimport type { QuoteEventRow, QuoteEventType, QuoteSubgraphEventType } from \"./types\";\n\n/** A single `quoteEvents` row as returned by the events query. */\nexport type RawQuoteEventNode = QuoteEventsForQuoteByTypeQuery[\"quoteEvents\"][number];\n\n/** Read a wei field from the metadata snapshot as a `bigint`, or `undefined` when absent / unparsable. */\nfunction optionalWei(value: unknown): bigint | undefined {\n if (value === undefined || value === null) return undefined;\n const text = String(value).trim();\n if (text === \"\") return undefined;\n try {\n return BigInt(text);\n } catch {\n return undefined;\n }\n}\n\n/** Parse the event `metadata` JSON, returning `null` on absence or malformed input. */\nfunction parseMetadata(raw: string | null): Record<string, unknown> | null {\n if (!raw) return null;\n try {\n return JSON.parse(raw) as Record<string, unknown>;\n } catch {\n return null;\n }\n}\n\n/**\n * Decode one raw subgraph `QuoteEvent` row into a {@link QuoteEventRow}. The\n * `metadata` JSON varies per event type — every recognized field is decoded and\n * placed on the typed row; missing fields stay `undefined`.\n */\nexport function toQuoteEventRow<TType extends QuoteSubgraphEventType = QuoteEventType>(\n row: RawQuoteEventNode,\n): QuoteEventRow<TType> {\n const metadata = parseMetadata(row.metadata);\n return {\n eventId: row.id,\n quoteId: toBigIntOrZero(row.quoteId),\n type: row.type as TType,\n timestamp: Number(row.timestamp),\n blockNumber: row.blockNumber ? BigInt(row.blockNumber) : undefined,\n transaction: row.transaction ? (row.transaction as Hex) : undefined,\n newPrice: metadata ? optionalWei(metadata.newPrice) : undefined,\n prevPrice: metadata ? optionalWei(metadata.prevPrice) : undefined,\n openQuantity: metadata ? optionalWei(metadata.openQuantity) : undefined,\n fundingPaid: metadata ? optionalWei(metadata.fundingPaid) : undefined,\n fundingReceived: metadata ? optionalWei(metadata.fundingReceived) : undefined,\n rate: metadata ? optionalWei(metadata.rate) : undefined,\n rawMetadata: row.metadata,\n };\n}\n"],"mappings":";;AASA,SAAS,EAAY,GAAoC;CACvD,IAAI,KAAiC,MAAM;CAC3C,IAAM,IAAO,OAAO,CAAK,EAAE,KAAK;CAC5B,UAAS,IACb,IAAI;EACF,OAAO,OAAO,CAAI;CACpB,QAAQ;EACN;CACF;AACF;AAGA,SAAS,EAAc,GAAoD;CACzE,IAAI,CAAC,GAAK,OAAO;CACjB,IAAI;EACF,OAAO,KAAK,MAAM,CAAG;CACvB,QAAQ;EACN,OAAO;CACT;AACF;AAOA,SAAgB,EACd,GACsB;CACtB,IAAM,IAAW,EAAc,EAAI,QAAQ;CAC3C,OAAO;EACL,SAAS,EAAI;EACb,SAAS,EAAe,EAAI,OAAO;EACnC,MAAM,EAAI;EACV,WAAW,OAAO,EAAI,SAAS;EAC/B,aAAa,EAAI,cAAc,OAAO,EAAI,WAAW,IAAI,KAAA;EACzD,aAAa,EAAI,cAAe,EAAI,cAAsB,KAAA;EAC1D,UAAU,IAAW,EAAY,EAAS,QAAQ,IAAI,KAAA;EACtD,WAAW,IAAW,EAAY,EAAS,SAAS,IAAI,KAAA;EACxD,cAAc,IAAW,EAAY,EAAS,YAAY,IAAI,KAAA;EAC9D,aAAa,IAAW,EAAY,EAAS,WAAW,IAAI,KAAA;EAC5D,iBAAiB,IAAW,EAAY,EAAS,eAAe,IAAI,KAAA;EACpE,MAAM,IAAW,EAAY,EAAS,IAAI,IAAI,KAAA;EAC9C,aAAa,EAAI;CACnB;AACF"}
@@ -1,4 +1,5 @@
1
1
  import { Hex } from 'viem';
2
+ import { QuoteCloseEventType } from '../get-quote-history/types.js';
2
3
  /**
3
4
  * Subgraph `QuoteEvent.type` values for non-terminal events that touch a quote's
4
5
  * open price or funding. Terminal close/liquidation events live on
@@ -32,6 +33,13 @@ export declare const PRICE_HISTORY_EVENT_TYPES: readonly QuoteEventType[];
32
33
  * metadata. Pair with `getQuotesEventsByType` for a whole {@link QuoteGroup}.
33
34
  */
34
35
  export declare const FUNDING_HISTORY_EVENT_TYPES: readonly QuoteEventType[];
36
+ /**
37
+ * Any subgraph `QuoteEvent.type`. The known values ({@link QuoteEventType},
38
+ * {@link QuoteCloseEventType}) autocomplete; every other value the subgraph
39
+ * emits (`SEND_QUOTE`, `OPEN_POSITION`, `QUOTE_ADJUSTED`, …) passes through as a
40
+ * string, so a read is never limited to the types this release names.
41
+ */
42
+ export type QuoteSubgraphEventType = QuoteEventType | QuoteCloseEventType | (string & {});
35
43
  /**
36
44
  * One decoded `QuoteEvent` row. `type` identifies which event family this row
37
45
  * belongs to (price update vs funding charge); the decoded metadata fields are
@@ -39,13 +47,16 @@ export declare const FUNDING_HISTORY_EVENT_TYPES: readonly QuoteEventType[];
39
47
  *
40
48
  * All amount and price fields are 18-decimal-wei `bigint`.
41
49
  */
42
- export interface QuoteEventRow {
50
+ export interface QuoteEventRow<TType extends QuoteSubgraphEventType = QuoteEventType> {
43
51
  /** Subgraph `QuoteEvent.id` (stable; use as the React key). */
44
52
  eventId: string;
45
53
  /** On-chain quote id this row belongs to. */
46
54
  quoteId: bigint;
47
- /** Event-type discriminant — tells the UI which fields it cares about. */
48
- type: QuoteEventType;
55
+ /**
56
+ * Event-type discriminant — tells the UI which fields it cares about. Narrowed
57
+ * to the types the read asked for.
58
+ */
59
+ type: TType;
49
60
  /** Event block timestamp in seconds. */
50
61
  timestamp: number;
51
62
  /** Block number, when available. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quote-events-by-type/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEhC;;;;GAIG;AACH,oBAAY,cAAc;IACxB,uEAAuE;IACvE,UAAU,gBAAgB;IAC1B,qFAAqF;IACrF,iBAAiB,wBAAwB;IACzC,2EAA2E;IAC3E,2BAA2B,mCAAmC;CAC/D;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,cAAc,EAI9D,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,EAAE,SAAS,cAAc,EAGhE,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,IAAI,EAAE,cAAc,CAAC;IACrB,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4FAA4F;IAC5F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quote-events-by-type/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE;;;;GAIG;AACH,oBAAY,cAAc;IACxB,uEAAuE;IACvE,UAAU,gBAAgB;IAC1B,qFAAqF;IACrF,iBAAiB,wBAAwB;IACzC,2EAA2E;IAC3E,2BAA2B,mCAAmC;CAC/D;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,cAAc,EAI9D,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,EAAE,SAAS,cAAc,EAGhE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,cAAc,GAAG,mBAAmB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAE1F;;;;;;GAMG;AACH,MAAM,WAAW,aAAa,CAAC,KAAK,SAAS,sBAAsB,GAAG,cAAc;IAClF,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,IAAI,EAAE,KAAK,CAAC;IACZ,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4FAA4F;IAC5F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/quotes/get-quote-events-by-type/types.ts"],"sourcesContent":["import type { Hex } from \"viem\";\n\n/**\n * Subgraph `QuoteEvent.type` values for non-terminal events that touch a quote's\n * open price or funding. Terminal close/liquidation events live on\n * {@link \"QuoteCloseEventType\"} (see `getQuoteHistory`).\n */\nexport enum QuoteEventType {\n /** Open-price recompute on a partial close (settle unrealized PnL). */\n SettleUpnl = \"SETTLE_UPNL\",\n /** Periodic funding-rate tick (carries a `rate` and the resulting paid/received). */\n ChargeFundingRate = \"CHARGE_FUNDING_RATE\",\n /** Catch-up charge of accumulated funding that was previously deferred. */\n ChargeAccumulatedFundingFee = \"CHARGE_ACCUMULATED_FUNDING_FEE\",\n}\n\n/**\n * Every event type that contributes to a quote's open-price history.\n *\n * Includes both explicit price-recompute events (`SETTLE_UPNL`) and funding-rate\n * charges (`CHARGE_FUNDING_RATE`, `CHARGE_ACCUMULATED_FUNDING_FEE`) — funding\n * ticks also adjust the open price as a side effect, so they belong in the same\n * timeline. Each row carries the {@link QuoteEventType} discriminant so the UI\n * can label and lay it out per type.\n */\nexport const PRICE_HISTORY_EVENT_TYPES: readonly QuoteEventType[] = [\n QuoteEventType.SettleUpnl,\n QuoteEventType.ChargeFundingRate,\n QuoteEventType.ChargeAccumulatedFundingFee,\n];\n\n/**\n * Every event type that settles funding on a quote — the per-tick rows behind a\n * position's funding history.\n *\n * A subset of {@link PRICE_HISTORY_EVENT_TYPES}: it drops `SETTLE_UPNL` (an\n * open-price recompute that moves no funding) and keeps only the two charge\n * events, each of which carries `fundingPaid` / `fundingReceived` / `rate` in its\n * metadata. Pair with `getQuotesEventsByType` for a whole {@link QuoteGroup}.\n */\nexport const FUNDING_HISTORY_EVENT_TYPES: readonly QuoteEventType[] = [\n QuoteEventType.ChargeFundingRate,\n QuoteEventType.ChargeAccumulatedFundingFee,\n];\n\n/**\n * One decoded `QuoteEvent` row. `type` identifies which event family this row\n * belongs to (price update vs funding charge); the decoded metadata fields are\n * present whenever the underlying JSON carried them.\n *\n * All amount and price fields are 18-decimal-wei `bigint`.\n */\nexport interface QuoteEventRow {\n /** Subgraph `QuoteEvent.id` (stable; use as the React key). */\n eventId: string;\n /** On-chain quote id this row belongs to. */\n quoteId: bigint;\n /** Event-type discriminant — tells the UI which fields it cares about. */\n type: QuoteEventType;\n /** Event block timestamp in seconds. */\n timestamp: number;\n /** Block number, when available. */\n blockNumber?: bigint;\n /** Transaction hash, when available. */\n transaction?: Hex;\n /** New open price after the event (wei), when present in metadata. */\n newPrice?: bigint;\n /** Open price before the event (wei), when present in metadata. */\n prevPrice?: bigint;\n /** Remaining open quantity at the event (wei), when present in metadata. */\n openQuantity?: bigint;\n /** Funding partyA paid in this event (wei), when present in metadata. */\n fundingPaid?: bigint;\n /** Funding partyA received in this event (wei), when present in metadata. */\n fundingReceived?: bigint;\n /** Funding rate applied for the tick (signed `int256` as wei), when present in metadata. */\n rate?: bigint;\n /** Raw metadata JSON string from the subgraph, preserved for power users. */\n rawMetadata: string | null;\n}\n"],"mappings":";AAOA,IAAY,IAAL,yBAAA,GAAA;QAEL,EAAA,aAAA,eAEA,EAAA,oBAAA,uBAEA,EAAA,8BAAA;AACF,EAAA,CAAA,CAAA,GAWa,IAAuD;;;;AAIpE,GAWa,IAAyD,CAAA,uBAAA,gCAGtE"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/quotes/get-quote-events-by-type/types.ts"],"sourcesContent":["import type { Hex } from \"viem\";\nimport type { QuoteCloseEventType } from \"../get-quote-history/types\";\n\n/**\n * Subgraph `QuoteEvent.type` values for non-terminal events that touch a quote's\n * open price or funding. Terminal close/liquidation events live on\n * {@link \"QuoteCloseEventType\"} (see `getQuoteHistory`).\n */\nexport enum QuoteEventType {\n /** Open-price recompute on a partial close (settle unrealized PnL). */\n SettleUpnl = \"SETTLE_UPNL\",\n /** Periodic funding-rate tick (carries a `rate` and the resulting paid/received). */\n ChargeFundingRate = \"CHARGE_FUNDING_RATE\",\n /** Catch-up charge of accumulated funding that was previously deferred. */\n ChargeAccumulatedFundingFee = \"CHARGE_ACCUMULATED_FUNDING_FEE\",\n}\n\n/**\n * Every event type that contributes to a quote's open-price history.\n *\n * Includes both explicit price-recompute events (`SETTLE_UPNL`) and funding-rate\n * charges (`CHARGE_FUNDING_RATE`, `CHARGE_ACCUMULATED_FUNDING_FEE`) — funding\n * ticks also adjust the open price as a side effect, so they belong in the same\n * timeline. Each row carries the {@link QuoteEventType} discriminant so the UI\n * can label and lay it out per type.\n */\nexport const PRICE_HISTORY_EVENT_TYPES: readonly QuoteEventType[] = [\n QuoteEventType.SettleUpnl,\n QuoteEventType.ChargeFundingRate,\n QuoteEventType.ChargeAccumulatedFundingFee,\n];\n\n/**\n * Every event type that settles funding on a quote — the per-tick rows behind a\n * position's funding history.\n *\n * A subset of {@link PRICE_HISTORY_EVENT_TYPES}: it drops `SETTLE_UPNL` (an\n * open-price recompute that moves no funding) and keeps only the two charge\n * events, each of which carries `fundingPaid` / `fundingReceived` / `rate` in its\n * metadata. Pair with `getQuotesEventsByType` for a whole {@link QuoteGroup}.\n */\nexport const FUNDING_HISTORY_EVENT_TYPES: readonly QuoteEventType[] = [\n QuoteEventType.ChargeFundingRate,\n QuoteEventType.ChargeAccumulatedFundingFee,\n];\n\n/**\n * Any subgraph `QuoteEvent.type`. The known values ({@link QuoteEventType},\n * {@link QuoteCloseEventType}) autocomplete; every other value the subgraph\n * emits (`SEND_QUOTE`, `OPEN_POSITION`, `QUOTE_ADJUSTED`, …) passes through as a\n * string, so a read is never limited to the types this release names.\n */\nexport type QuoteSubgraphEventType = QuoteEventType | QuoteCloseEventType | (string & {});\n\n/**\n * One decoded `QuoteEvent` row. `type` identifies which event family this row\n * belongs to (price update vs funding charge); the decoded metadata fields are\n * present whenever the underlying JSON carried them.\n *\n * All amount and price fields are 18-decimal-wei `bigint`.\n */\nexport interface QuoteEventRow<TType extends QuoteSubgraphEventType = QuoteEventType> {\n /** Subgraph `QuoteEvent.id` (stable; use as the React key). */\n eventId: string;\n /** On-chain quote id this row belongs to. */\n quoteId: bigint;\n /**\n * Event-type discriminant — tells the UI which fields it cares about. Narrowed\n * to the types the read asked for.\n */\n type: TType;\n /** Event block timestamp in seconds. */\n timestamp: number;\n /** Block number, when available. */\n blockNumber?: bigint;\n /** Transaction hash, when available. */\n transaction?: Hex;\n /** New open price after the event (wei), when present in metadata. */\n newPrice?: bigint;\n /** Open price before the event (wei), when present in metadata. */\n prevPrice?: bigint;\n /** Remaining open quantity at the event (wei), when present in metadata. */\n openQuantity?: bigint;\n /** Funding partyA paid in this event (wei), when present in metadata. */\n fundingPaid?: bigint;\n /** Funding partyA received in this event (wei), when present in metadata. */\n fundingReceived?: bigint;\n /** Funding rate applied for the tick (signed `int256` as wei), when present in metadata. */\n rate?: bigint;\n /** Raw metadata JSON string from the subgraph, preserved for power users. */\n rawMetadata: string | null;\n}\n"],"mappings":";AAQA,IAAY,IAAL,yBAAA,GAAA;QAEL,EAAA,aAAA,eAEA,EAAA,oBAAA,uBAEA,EAAA,8BAAA;AACF,EAAA,CAAA,CAAA,GAWa,IAAuD;;;;AAIpE,GAWa,IAAyD,CAAA,uBAAA,gCAGtE"}
@@ -1,3 +1,4 @@
1
+ import { Address } from 'viem';
1
2
  import { Config } from '../../core/config/index.js';
2
3
  import { ChainIdParameter, Compute } from '../../shared/types/properties.js';
3
4
  import { QuoteFundingData } from './types.js';
@@ -16,6 +17,12 @@ export declare const QUOTES_FUNDING_MAX_IDS_PER_REQUEST = 1000;
16
17
  export type GetQuoteFundingParameters = Compute<ChainIdParameter & {
17
18
  /** On-chain quote ids to read. */
18
19
  quoteIds: readonly bigint[];
20
+ /**
21
+ * The deployment's diamond address (the subgraph's `source`). Omit to match a
22
+ * quote id on any deployment the subgraph indexes; pass it when one subgraph
23
+ * indexes several diamonds, whose quote ids can collide.
24
+ */
25
+ source?: Address;
19
26
  }>;
20
27
  /** Return type of {@link getQuoteFunding}. */
21
28
  export interface GetQuoteFundingReturnType {
@@ -47,7 +54,7 @@ export interface GetQuoteFundingReturnType {
47
54
  * indexing lag.
48
55
  *
49
56
  * @param config - The SDK config.
50
- * @param parameters - Quote ids and optional chain id.
57
+ * @param parameters - Quote ids, optional diamond (`source`), optional chain id.
51
58
  * @returns Funding rows (merged across all internal requests) plus the input ids
52
59
  * the subgraph did not return, computed across the full input set.
53
60
  * @throws {SymmError} when the chain has no analytics subgraph.
@@ -55,7 +62,10 @@ export interface GetQuoteFundingReturnType {
55
62
  *
56
63
  * @example
57
64
  * ```ts
58
- * const { rows, missingQuoteIds } = await getQuoteFunding(config, { quoteIds: [7334n, 7335n] });
65
+ * const { rows, missingQuoteIds } = await getQuoteFunding(config, {
66
+ * quoteIds: [7334n, 7335n],
67
+ * source: "0xdiamond…",
68
+ * });
59
69
  * ```
60
70
  */
61
71
  export declare function getQuoteFunding(config: Config, parameters: GetQuoteFundingParameters): Promise<GetQuoteFundingReturnType>;
@@ -1 +1 @@
1
- {"version":3,"file":"get-quote-funding.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quote-funding/get-quote-funding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAI/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,kCAAkC,OAAO,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAC7C,gBAAgB,GAAG;IACjB,kCAAkC;IAClC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B,CACF,CAAC;AAEF,8CAA8C;AAC9C,MAAM,WAAW,yBAAyB;IACxC,kDAAkD;IAClD,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,sEAAsE;IACtE,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,yBAAyB,GACpC,OAAO,CAAC,yBAAyB,CAAC,CAmBpC"}
1
+ {"version":3,"file":"get-quote-funding.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quote-funding/get-quote-funding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAM/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,kCAAkC,OAAO,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAC7C,gBAAgB,GAAG;IACjB,kCAAkC;IAClC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CACF,CAAC;AAEF,8CAA8C;AAC9C,MAAM,WAAW,yBAAyB;IACxC,kDAAkD;IAClD,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,sEAAsE;IACtE,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,yBAAyB,GACpC,OAAO,CAAC,yBAAyB,CAAC,CAyBpC"}
@@ -1,33 +1,37 @@
1
1
  import { querySubgraph as e } from "../../symmio-subgraph/query-subgraph/query-subgraph.js";
2
- import { QuotesFundingDocument as t } from "./query-document.js";
3
- import { toQuoteFundingRow as n } from "./to-funding-row.js";
2
+ import { compactWhere as t, stringList as n } from "../../symmio-subgraph/subgraph-filters.js";
3
+ import { QuotesFundingDocument as r } from "./query-document.js";
4
+ import { toQuoteFundingRow as i } from "./to-funding-row.js";
4
5
  //#region src/quotes/get-quote-funding/get-quote-funding.ts
5
- var r = 1e3;
6
- function i(e) {
6
+ var a = 1e3;
7
+ function o(e) {
7
8
  let t = [];
8
- for (let n = 0; n < e.length; n += r) t.push(e.slice(n, n + r));
9
+ for (let n = 0; n < e.length; n += a) t.push(e.slice(n, n + a));
9
10
  return t;
10
11
  }
11
- async function a(a, o) {
12
- let { chainId: s, quoteIds: c } = o;
13
- if (c.length === 0) return {
12
+ async function s(s, c) {
13
+ let { chainId: l, quoteIds: u, source: d } = c;
14
+ if (u.length === 0) return {
14
15
  rows: [],
15
16
  missingQuoteIds: []
16
17
  };
17
- let l = (await Promise.all(i(c).map((n) => e(a, {
18
- chainId: s,
19
- document: t,
18
+ let f = (await Promise.all(o(u).map((i) => e(s, {
19
+ chainId: l,
20
+ document: r,
20
21
  variables: {
21
- ids: n.map((e) => e.toString()),
22
- first: r
22
+ where: t({
23
+ quoteId_in: n(i),
24
+ source: d?.toLowerCase()
25
+ }),
26
+ first: a
23
27
  }
24
- })))).flatMap((e) => e.quotes.map(n)), u = new Set(l.map((e) => e.quoteId));
28
+ })))).flatMap((e) => e.quotes.map(i)), p = new Set(f.map((e) => e.quoteId));
25
29
  return {
26
- rows: l,
27
- missingQuoteIds: c.filter((e) => !u.has(e))
30
+ rows: f,
31
+ missingQuoteIds: u.filter((e) => !p.has(e))
28
32
  };
29
33
  }
30
34
  //#endregion
31
- export { r as QUOTES_FUNDING_MAX_IDS_PER_REQUEST, a as getQuoteFunding };
35
+ export { a as QUOTES_FUNDING_MAX_IDS_PER_REQUEST, s as getQuoteFunding };
32
36
 
33
37
  //# sourceMappingURL=get-quote-funding.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-quote-funding.js","names":[],"sources":["../../../src/quotes/get-quote-funding/get-quote-funding.ts"],"sourcesContent":["import type { Config } from \"../../core/config\";\nimport type { ChainIdParameter, Compute } from \"../../shared/types/properties\";\nimport { querySubgraph } from \"../../symmio-subgraph/query-subgraph\";\nimport { QuotesFundingDocument } from \"./query-document\";\nimport { toQuoteFundingRow } from \"./to-funding-row\";\nimport type { QuoteFundingData } from \"./types\";\n\n/**\n * Maximum number of quote ids sent in one `QuotesFunding` request.\n *\n * The Graph caps a `first` argument at 1000 entities per query (and silently\n * defaults to 100 when `first` is omitted), so {@link getQuoteFunding} chunks\n * its input at this size and merges the responses. Exported so callers that\n * size their own batches (and tests) can reuse the exact ceiling.\n */\nexport const QUOTES_FUNDING_MAX_IDS_PER_REQUEST = 1000;\n\n/**\n * Parameters for {@link getQuoteFunding}.\n */\nexport type GetQuoteFundingParameters = Compute<\n ChainIdParameter & {\n /** On-chain quote ids to read. */\n quoteIds: readonly bigint[];\n }\n>;\n\n/** Return type of {@link getQuoteFunding}. */\nexport interface GetQuoteFundingReturnType {\n /** One row per quote id the subgraph returned. */\n rows: QuoteFundingData[];\n /** Subset of input ids the subgraph did not return (indexing lag). */\n missingQuoteIds: bigint[];\n}\n\n/**\n * Split an id list into request-sized batches of at most\n * {@link QUOTES_FUNDING_MAX_IDS_PER_REQUEST} ids, preserving input order.\n */\nfunction chunkQuoteIds(quoteIds: readonly bigint[]): bigint[][] {\n const batches: bigint[][] = [];\n for (let index = 0; index < quoteIds.length; index += QUOTES_FUNDING_MAX_IDS_PER_REQUEST) {\n batches.push(quoteIds.slice(index, index + QUOTES_FUNDING_MAX_IDS_PER_REQUEST));\n }\n return batches;\n}\n\n/**\n * Read funding totals (`userPaidFunding`, `userReceivedFunding`) for a batch of\n * quotes from the analytics subgraph. Filters by the protocol-level `quoteId`\n * scalar so callers never need the diamond address.\n *\n * The action **pages internally**: `quoteIds` is chunked into requests of at\n * most {@link QUOTES_FUNDING_MAX_IDS_PER_REQUEST} ids, issued concurrently, and\n * the responses are merged. Callers pass the full id list — however long — and\n * never need to chunk it themselves. (Without an explicit `first`, The Graph\n * caps a query at 100 entities, which silently truncated large batches; the\n * extras then surfaced as `missingQuoteIds` and any caller that ignored\n * completeness rendered a wrong total.)\n *\n * The returned funding is what the analytics subgraph has **settled to date**:\n * funding accrued since the quote's last funding charge is not indexed by the\n * subgraph and is therefore not included — read it with\n * {@link getQuotePendingFunding}.\n *\n * Returns both the resolved rows and any input ids the subgraph did not yet\n * surface — callers (typically the React layer) decide whether to refetch on\n * indexing lag.\n *\n * @param config - The SDK config.\n * @param parameters - Quote ids and optional chain id.\n * @returns Funding rows (merged across all internal requests) plus the input ids\n * the subgraph did not return, computed across the full input set.\n * @throws {SymmError} when the chain has no analytics subgraph.\n * @throws {SymmApiError} when any subgraph request fails.\n *\n * @example\n * ```ts\n * const { rows, missingQuoteIds } = await getQuoteFunding(config, { quoteIds: [7334n, 7335n] });\n * ```\n */\nexport async function getQuoteFunding(\n config: Config,\n parameters: GetQuoteFundingParameters,\n): Promise<GetQuoteFundingReturnType> {\n const { chainId, quoteIds } = parameters;\n\n if (quoteIds.length === 0) return { rows: [], missingQuoteIds: [] };\n\n const responses = await Promise.all(\n chunkQuoteIds(quoteIds).map((batch) =>\n querySubgraph(config, {\n chainId,\n document: QuotesFundingDocument,\n variables: { ids: batch.map((id) => id.toString()), first: QUOTES_FUNDING_MAX_IDS_PER_REQUEST },\n }),\n ),\n );\n\n const rows = responses.flatMap((data) => data.quotes.map(toQuoteFundingRow));\n const seen = new Set(rows.map((row) => row.quoteId));\n const missingQuoteIds = quoteIds.filter((id) => !seen.has(id));\n return { rows, missingQuoteIds };\n}\n"],"mappings":";;;;AAeA,IAAa,IAAqC;AAwBlD,SAAS,EAAc,GAAyC;CAC9D,IAAM,IAAsB,CAAC;CAC7B,KAAK,IAAI,IAAQ,GAAG,IAAQ,EAAS,QAAQ,KAAS,GACpD,EAAQ,KAAK,EAAS,MAAM,GAAO,IAAQ,CAAkC,CAAC;CAEhF,OAAO;AACT;AAoCA,eAAsB,EACpB,GACA,GACoC;CACpC,IAAM,EAAE,YAAS,gBAAa;CAE9B,IAAI,EAAS,WAAW,GAAG,OAAO;EAAE,MAAM,CAAC;EAAG,iBAAiB,CAAC;CAAE;CAYlE,IAAM,KAAO,MAVW,QAAQ,IAC9B,EAAc,CAAQ,EAAE,KAAK,MAC3B,EAAc,GAAQ;EACpB;EACA,UAAU;EACV,WAAW;GAAE,KAAK,EAAM,KAAK,MAAO,EAAG,SAAS,CAAC;GAAG,OAAO;EAAmC;CAChG,CAAC,CACH,CACF,GAEuB,SAAS,MAAS,EAAK,OAAO,IAAI,CAAiB,CAAC,GACrE,IAAO,IAAI,IAAI,EAAK,KAAK,MAAQ,EAAI,OAAO,CAAC;CAEnD,OAAO;EAAE;EAAM,iBADS,EAAS,QAAQ,MAAO,CAAC,EAAK,IAAI,CAAE,CAC7C;CAAgB;AACjC"}
1
+ {"version":3,"file":"get-quote-funding.js","names":[],"sources":["../../../src/quotes/get-quote-funding/get-quote-funding.ts"],"sourcesContent":["import type { Address } from \"viem\";\nimport type { Config } from \"../../core/config\";\nimport type { ChainIdParameter, Compute } from \"../../shared/types/properties\";\nimport { querySubgraph } from \"../../symmio-subgraph/query-subgraph\";\nimport { compactWhere, stringList } from \"../../symmio-subgraph/subgraph-filters\";\nimport type { Quote_Filter } from \"../../symmio-subgraph/types/generated/analytics/graphql\";\nimport { QuotesFundingDocument } from \"./query-document\";\nimport { toQuoteFundingRow } from \"./to-funding-row\";\nimport type { QuoteFundingData } from \"./types\";\n\n/**\n * Maximum number of quote ids sent in one `QuotesFunding` request.\n *\n * The Graph caps a `first` argument at 1000 entities per query (and silently\n * defaults to 100 when `first` is omitted), so {@link getQuoteFunding} chunks\n * its input at this size and merges the responses. Exported so callers that\n * size their own batches (and tests) can reuse the exact ceiling.\n */\nexport const QUOTES_FUNDING_MAX_IDS_PER_REQUEST = 1000;\n\n/**\n * Parameters for {@link getQuoteFunding}.\n */\nexport type GetQuoteFundingParameters = Compute<\n ChainIdParameter & {\n /** On-chain quote ids to read. */\n quoteIds: readonly bigint[];\n /**\n * The deployment's diamond address (the subgraph's `source`). Omit to match a\n * quote id on any deployment the subgraph indexes; pass it when one subgraph\n * indexes several diamonds, whose quote ids can collide.\n */\n source?: Address;\n }\n>;\n\n/** Return type of {@link getQuoteFunding}. */\nexport interface GetQuoteFundingReturnType {\n /** One row per quote id the subgraph returned. */\n rows: QuoteFundingData[];\n /** Subset of input ids the subgraph did not return (indexing lag). */\n missingQuoteIds: bigint[];\n}\n\n/**\n * Split an id list into request-sized batches of at most\n * {@link QUOTES_FUNDING_MAX_IDS_PER_REQUEST} ids, preserving input order.\n */\nfunction chunkQuoteIds(quoteIds: readonly bigint[]): bigint[][] {\n const batches: bigint[][] = [];\n for (let index = 0; index < quoteIds.length; index += QUOTES_FUNDING_MAX_IDS_PER_REQUEST) {\n batches.push(quoteIds.slice(index, index + QUOTES_FUNDING_MAX_IDS_PER_REQUEST));\n }\n return batches;\n}\n\n/**\n * Read funding totals (`userPaidFunding`, `userReceivedFunding`) for a batch of\n * quotes from the analytics subgraph. Filters by the protocol-level `quoteId`\n * scalar so callers never need the diamond address.\n *\n * The action **pages internally**: `quoteIds` is chunked into requests of at\n * most {@link QUOTES_FUNDING_MAX_IDS_PER_REQUEST} ids, issued concurrently, and\n * the responses are merged. Callers pass the full id list — however long — and\n * never need to chunk it themselves. (Without an explicit `first`, The Graph\n * caps a query at 100 entities, which silently truncated large batches; the\n * extras then surfaced as `missingQuoteIds` and any caller that ignored\n * completeness rendered a wrong total.)\n *\n * The returned funding is what the analytics subgraph has **settled to date**:\n * funding accrued since the quote's last funding charge is not indexed by the\n * subgraph and is therefore not included — read it with\n * {@link getQuotePendingFunding}.\n *\n * Returns both the resolved rows and any input ids the subgraph did not yet\n * surface — callers (typically the React layer) decide whether to refetch on\n * indexing lag.\n *\n * @param config - The SDK config.\n * @param parameters - Quote ids, optional diamond (`source`), optional chain id.\n * @returns Funding rows (merged across all internal requests) plus the input ids\n * the subgraph did not return, computed across the full input set.\n * @throws {SymmError} when the chain has no analytics subgraph.\n * @throws {SymmApiError} when any subgraph request fails.\n *\n * @example\n * ```ts\n * const { rows, missingQuoteIds } = await getQuoteFunding(config, {\n * quoteIds: [7334n, 7335n],\n * source: \"0xdiamond…\",\n * });\n * ```\n */\nexport async function getQuoteFunding(\n config: Config,\n parameters: GetQuoteFundingParameters,\n): Promise<GetQuoteFundingReturnType> {\n const { chainId, quoteIds, source } = parameters;\n\n if (quoteIds.length === 0) return { rows: [], missingQuoteIds: [] };\n\n const responses = await Promise.all(\n chunkQuoteIds(quoteIds).map((batch) =>\n querySubgraph(config, {\n chainId,\n document: QuotesFundingDocument,\n variables: {\n where: compactWhere<Quote_Filter>({\n quoteId_in: stringList(batch),\n source: source?.toLowerCase(),\n }),\n first: QUOTES_FUNDING_MAX_IDS_PER_REQUEST,\n },\n }),\n ),\n );\n\n const rows = responses.flatMap((data) => data.quotes.map(toQuoteFundingRow));\n const seen = new Set(rows.map((row) => row.quoteId));\n const missingQuoteIds = quoteIds.filter((id) => !seen.has(id));\n return { rows, missingQuoteIds };\n}\n"],"mappings":";;;;;AAkBA,IAAa,IAAqC;AA8BlD,SAAS,EAAc,GAAyC;CAC9D,IAAM,IAAsB,CAAC;CAC7B,KAAK,IAAI,IAAQ,GAAG,IAAQ,EAAS,QAAQ,KAAS,GACpD,EAAQ,KAAK,EAAS,MAAM,GAAO,IAAQ,CAAkC,CAAC;CAEhF,OAAO;AACT;AAuCA,eAAsB,EACpB,GACA,GACoC;CACpC,IAAM,EAAE,YAAS,aAAU,cAAW;CAEtC,IAAI,EAAS,WAAW,GAAG,OAAO;EAAE,MAAM,CAAC;EAAG,iBAAiB,CAAC;CAAE;CAkBlE,IAAM,KAAO,MAhBW,QAAQ,IAC9B,EAAc,CAAQ,EAAE,KAAK,MAC3B,EAAc,GAAQ;EACpB;EACA,UAAU;EACV,WAAW;GACT,OAAO,EAA2B;IAChC,YAAY,EAAW,CAAK;IAC5B,QAAQ,GAAQ,YAAY;GAC9B,CAAC;GACD,OAAO;EACT;CACF,CAAC,CACH,CACF,GAEuB,SAAS,MAAS,EAAK,OAAO,IAAI,CAAiB,CAAC,GACrE,IAAO,IAAI,IAAI,EAAK,KAAK,MAAQ,EAAI,OAAO,CAAC;CAEnD,OAAO;EAAE;EAAM,iBADS,EAAS,QAAQ,MAAO,CAAC,EAAK,IAAI,CAAE,CAC7C;CAAgB;AACjC"}
@@ -2,12 +2,13 @@
2
2
  * Batch read of `userPaidFunding` / `userReceivedFunding` for the given on-chain
3
3
  * quote ids. Filters on the protocol-level `quoteId` scalar — not the subgraph's
4
4
  * opaque composite `id` — so callers never need the diamond address to query
5
- * funding.
5
+ * funding. The action builds `$where` (`quoteId_in`, plus `source` only when the
6
+ * caller passes a diamond), so an omitted filter is absent rather than null.
6
7
  *
7
8
  * The document compiles to a typed query string via graphql-codegen.
8
9
  */
9
10
  export declare const QuotesFundingDocument: import('../../symmio-subgraph/types/generated/analytics/graphql.js').TypedDocumentString<import('../../symmio-subgraph/types/generated/analytics/graphql.js').QuotesFundingQuery, {
10
- ids: Array<string> | string;
11
+ where: import('../../symmio-subgraph/types/generated/analytics/graphql.js').Quote_Filter;
11
12
  first: number;
12
13
  }>;
13
14
  //# sourceMappingURL=query-document.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-document.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quote-funding/query-document.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB;;;EAQhC,CAAC"}
1
+ {"version":3,"file":"query-document.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quote-funding/query-document.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB;;;EAQhC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { graphql as e } from "../../symmio-subgraph/types/generated/analytics/gql.js";
2
2
  //#region src/quotes/get-quote-funding/query-document.ts
3
- var t = e("\n query QuotesFunding($ids: [BigInt!]!, $first: Int!) {\n quotes(first: $first, where: { quoteId_in: $ids }) {\n quoteId\n userPaidFunding\n userReceivedFunding\n }\n }\n");
3
+ var t = e("\n query QuotesFunding($where: Quote_filter!, $first: Int!) {\n quotes(first: $first, where: $where) {\n quoteId\n userPaidFunding\n userReceivedFunding\n }\n }\n");
4
4
  //#endregion
5
5
  export { t as QuotesFundingDocument };
6
6
 
@@ -1 +1 @@
1
- {"version":3,"file":"query-document.js","names":[],"sources":["../../../src/quotes/get-quote-funding/query-document.ts"],"sourcesContent":["import { graphql } from \"../../symmio-subgraph/types/generated/analytics\";\n\n/**\n * Batch read of `userPaidFunding` / `userReceivedFunding` for the given on-chain\n * quote ids. Filters on the protocol-level `quoteId` scalar — not the subgraph's\n * opaque composite `id` — so callers never need the diamond address to query\n * funding.\n *\n * The document compiles to a typed query string via graphql-codegen.\n */\nexport const QuotesFundingDocument = graphql(`\n query QuotesFunding($ids: [BigInt!]!, $first: Int!) {\n quotes(first: $first, where: { quoteId_in: $ids }) {\n quoteId\n userPaidFunding\n userReceivedFunding\n }\n }\n`);\n"],"mappings":";;AAUA,IAAa,IAAwB,EAAQ,oMAQ5C"}
1
+ {"version":3,"file":"query-document.js","names":[],"sources":["../../../src/quotes/get-quote-funding/query-document.ts"],"sourcesContent":["import { graphql } from \"../../symmio-subgraph/types/generated/analytics\";\n\n/**\n * Batch read of `userPaidFunding` / `userReceivedFunding` for the given on-chain\n * quote ids. Filters on the protocol-level `quoteId` scalar — not the subgraph's\n * opaque composite `id` — so callers never need the diamond address to query\n * funding. The action builds `$where` (`quoteId_in`, plus `source` only when the\n * caller passes a diamond), so an omitted filter is absent rather than null.\n *\n * The document compiles to a typed query string via graphql-codegen.\n */\nexport const QuotesFundingDocument = graphql(`\n query QuotesFunding($where: Quote_filter!, $first: Int!) {\n quotes(first: $first, where: $where) {\n quoteId\n userPaidFunding\n userReceivedFunding\n }\n }\n`);\n"],"mappings":";;AAWA,IAAa,IAAwB,EAAQ,2LAQ5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quote-funding/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAGnF,OAAO,EAAmB,KAAK,yBAAyB,EAAE,KAAK,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEtH,sEAAsE;AACtE,MAAM,MAAM,mBAAmB,GAAG,yBAAyB,CAAC;AAE5D;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,yBAAyB,GAAG,kBAAkB,CAAC;;GAGvG;AAED,kEAAkE;AAClE,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAEjF;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAC1C,yBAAyB,GAAG,cAAc,CAAC,mBAAmB,EAAE,KAAK,EAAE,mBAAmB,EAAE,uBAAuB,CAAC,CACrH,CAAC;AAEF,8EAA8E;AAC9E,MAAM,MAAM,2BAA2B,GAAG,kBAAkB,CAC1D,mBAAmB,EACnB,KAAK,EACL,mBAAmB,EACnB,uBAAuB,CACxB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,sBAAsB,GAC9B,2BAA2B,CAU7B"}
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quote-funding/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAGnF,OAAO,EAAmB,KAAK,yBAAyB,EAAE,KAAK,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEtH,sEAAsE;AACtE,MAAM,MAAM,mBAAmB,GAAG,yBAAyB,CAAC;AAE5D;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,yBAAyB,GAAG,kBAAkB,CAAC;;GAGvG;AAED,kEAAkE;AAClE,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAEjF;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAC1C,yBAAyB,GAAG,cAAc,CAAC,mBAAmB,EAAE,KAAK,EAAE,mBAAmB,EAAE,uBAAuB,CAAC,CACrH,CAAC;AAEF,8EAA8E;AAC9E,MAAM,MAAM,2BAA2B,GAAG,kBAAkB,CAC1D,mBAAmB,EACnB,KAAK,EACL,mBAAmB,EACnB,uBAAuB,CACxB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,sBAAsB,GAC9B,2BAA2B,CAW7B"}
@@ -18,7 +18,8 @@ function i(e, n) {
18
18
  enabled: (n.query?.enabled ?? !0) && n.quoteIds.length > 0,
19
19
  queryFn: () => t(e, {
20
20
  chainId: n.chainId,
21
- quoteIds: n.quoteIds
21
+ quoteIds: n.quoteIds,
22
+ source: n.source
22
23
  })
23
24
  };
24
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"query.js","names":[],"sources":["../../../src/quotes/get-quote-funding/query.ts"],"sourcesContent":["import type { Config } from \"../../core/config\";\nimport type { Compute, ConfigKeyParameter } from \"../../shared/types/properties\";\nimport type { QueryParameter, SymmioQueryOptions } from \"../../shared/types/query\";\nimport { filterQueryOptions } from \"../../shared/utils/query\";\nimport { toQuoteIdKeyPart } from \"../quote-id-key-part\";\nimport { getQuoteFunding, type GetQuoteFundingParameters, type GetQuoteFundingReturnType } from \"./get-quote-funding\";\n\n/** Data resolved by the {@link getQuoteFundingQueryOptions} query. */\nexport type GetQuoteFundingData = GetQuoteFundingReturnType;\n\n/**\n * Build the TanStack Query key for {@link getQuoteFundingQueryOptions}.\n *\n * @param options - Query parameters (quote ids, chain id, config key).\n * @returns A stable, hashable query key. The `bigint` quote ids are stringified so\n * the key is JSON-safe, and sorted so id order does not fragment the cache.\n */\nexport function getQuoteFundingQueryKey(options: Compute<GetQuoteFundingParameters & ConfigKeyParameter>) {\n const filtered = filterQueryOptions(options);\n return [\"getQuoteFunding\", { ...filtered, quoteIds: toQuoteIdKeyPart(options.quoteIds) }] as const;\n}\n\n/** Query-key type produced by {@link getQuoteFundingQueryKey}. */\nexport type GetQuoteFundingQueryKey = ReturnType<typeof getQuoteFundingQueryKey>;\n\n/**\n * Options accepted by {@link getQuoteFundingQueryOptions}: the action's\n * parameters plus TanStack overrides.\n */\nexport type GetQuoteFundingOptions = Compute<\n GetQuoteFundingParameters & QueryParameter<GetQuoteFundingData, Error, GetQuoteFundingData, GetQuoteFundingQueryKey>\n>;\n\n/** TanStack Query options returned by {@link getQuoteFundingQueryOptions}. */\nexport type GetQuoteFundingQueryOptions = SymmioQueryOptions<\n GetQuoteFundingData,\n Error,\n GetQuoteFundingData,\n GetQuoteFundingQueryKey\n>;\n\n/**\n * Build TanStack Query options for {@link getQuoteFunding}. The query is\n * disabled until at least one `quoteId` is supplied.\n *\n * @param config - The SDK config.\n * @param options - Query parameters and TanStack overrides.\n * @returns Options to pass to `useQuery` / `queryClient.fetchQuery`.\n *\n * @example\n * ```ts\n * useQuery(\n * getQuoteFundingQueryOptions(config, { quoteIds: [7334n] }),\n * );\n * ```\n */\nexport function getQuoteFundingQueryOptions(\n config: Config,\n options: GetQuoteFundingOptions,\n): GetQuoteFundingQueryOptions {\n return {\n ...options.query,\n queryKey: getQuoteFundingQueryKey({\n ...options,\n configKey: config.getChainConfigKey(options.chainId),\n }),\n enabled: (options.query?.enabled ?? true) && options.quoteIds.length > 0,\n queryFn: () => getQuoteFunding(config, { chainId: options.chainId, quoteIds: options.quoteIds }),\n };\n}\n"],"mappings":";;;;AAiBA,SAAgB,EAAwB,GAAkE;CAExG,OAAO,CAAC,mBAAmB;EAAE,GADZ,EAAmB,CACJ;EAAU,UAAU,EAAiB,EAAQ,QAAQ;CAAE,CAAC;AAC1F;AAoCA,SAAgB,EACd,GACA,GAC6B;CAC7B,OAAO;EACL,GAAG,EAAQ;EACX,UAAU,EAAwB;GAChC,GAAG;GACH,WAAW,EAAO,kBAAkB,EAAQ,OAAO;EACrD,CAAC;EACD,UAAU,EAAQ,OAAO,WAAW,OAAS,EAAQ,SAAS,SAAS;EACvE,eAAe,EAAgB,GAAQ;GAAE,SAAS,EAAQ;GAAS,UAAU,EAAQ;EAAS,CAAC;CACjG;AACF"}
1
+ {"version":3,"file":"query.js","names":[],"sources":["../../../src/quotes/get-quote-funding/query.ts"],"sourcesContent":["import type { Config } from \"../../core/config\";\nimport type { Compute, ConfigKeyParameter } from \"../../shared/types/properties\";\nimport type { QueryParameter, SymmioQueryOptions } from \"../../shared/types/query\";\nimport { filterQueryOptions } from \"../../shared/utils/query\";\nimport { toQuoteIdKeyPart } from \"../quote-id-key-part\";\nimport { getQuoteFunding, type GetQuoteFundingParameters, type GetQuoteFundingReturnType } from \"./get-quote-funding\";\n\n/** Data resolved by the {@link getQuoteFundingQueryOptions} query. */\nexport type GetQuoteFundingData = GetQuoteFundingReturnType;\n\n/**\n * Build the TanStack Query key for {@link getQuoteFundingQueryOptions}.\n *\n * @param options - Query parameters (quote ids, chain id, config key).\n * @returns A stable, hashable query key. The `bigint` quote ids are stringified so\n * the key is JSON-safe, and sorted so id order does not fragment the cache.\n */\nexport function getQuoteFundingQueryKey(options: Compute<GetQuoteFundingParameters & ConfigKeyParameter>) {\n const filtered = filterQueryOptions(options);\n return [\"getQuoteFunding\", { ...filtered, quoteIds: toQuoteIdKeyPart(options.quoteIds) }] as const;\n}\n\n/** Query-key type produced by {@link getQuoteFundingQueryKey}. */\nexport type GetQuoteFundingQueryKey = ReturnType<typeof getQuoteFundingQueryKey>;\n\n/**\n * Options accepted by {@link getQuoteFundingQueryOptions}: the action's\n * parameters plus TanStack overrides.\n */\nexport type GetQuoteFundingOptions = Compute<\n GetQuoteFundingParameters & QueryParameter<GetQuoteFundingData, Error, GetQuoteFundingData, GetQuoteFundingQueryKey>\n>;\n\n/** TanStack Query options returned by {@link getQuoteFundingQueryOptions}. */\nexport type GetQuoteFundingQueryOptions = SymmioQueryOptions<\n GetQuoteFundingData,\n Error,\n GetQuoteFundingData,\n GetQuoteFundingQueryKey\n>;\n\n/**\n * Build TanStack Query options for {@link getQuoteFunding}. The query is\n * disabled until at least one `quoteId` is supplied.\n *\n * @param config - The SDK config.\n * @param options - Query parameters and TanStack overrides.\n * @returns Options to pass to `useQuery` / `queryClient.fetchQuery`.\n *\n * @example\n * ```ts\n * useQuery(\n * getQuoteFundingQueryOptions(config, { quoteIds: [7334n] }),\n * );\n * ```\n */\nexport function getQuoteFundingQueryOptions(\n config: Config,\n options: GetQuoteFundingOptions,\n): GetQuoteFundingQueryOptions {\n return {\n ...options.query,\n queryKey: getQuoteFundingQueryKey({\n ...options,\n configKey: config.getChainConfigKey(options.chainId),\n }),\n enabled: (options.query?.enabled ?? true) && options.quoteIds.length > 0,\n queryFn: () =>\n getQuoteFunding(config, { chainId: options.chainId, quoteIds: options.quoteIds, source: options.source }),\n };\n}\n"],"mappings":";;;;AAiBA,SAAgB,EAAwB,GAAkE;CAExG,OAAO,CAAC,mBAAmB;EAAE,GADZ,EAAmB,CACJ;EAAU,UAAU,EAAiB,EAAQ,QAAQ;CAAE,CAAC;AAC1F;AAoCA,SAAgB,EACd,GACA,GAC6B;CAC7B,OAAO;EACL,GAAG,EAAQ;EACX,UAAU,EAAwB;GAChC,GAAG;GACH,WAAW,EAAO,kBAAkB,EAAQ,OAAO;EACrD,CAAC;EACD,UAAU,EAAQ,OAAO,WAAW,OAAS,EAAQ,SAAS,SAAS;EACvE,eACE,EAAgB,GAAQ;GAAE,SAAS,EAAQ;GAAS,UAAU,EAAQ;GAAU,QAAQ,EAAQ;EAAO,CAAC;CAC5G;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"to-funding-row.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quote-funding/to-funding-row.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yDAAyD,CAAC;AAClG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,8DAA8D;AAC9D,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAOtE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,kBAAkB,GAAG,gBAAgB,CAS3E"}
1
+ {"version":3,"file":"to-funding-row.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quote-funding/to-funding-row.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yDAAyD,CAAC;AAClG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,8DAA8D;AAC9D,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,kBAAkB,GAAG,gBAAgB,CAS3E"}
@@ -1,7 +1,5 @@
1
+ import { toBigIntOrZero as e } from "../../symmio-subgraph/subgraph-decode.js";
1
2
  //#region src/quotes/get-quote-funding/to-funding-row.ts
2
- function e(e) {
3
- return e ? BigInt(e) : 0n;
4
- }
5
3
  function t(t) {
6
4
  let n = e(t.userPaidFunding), r = e(t.userReceivedFunding);
7
5
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"to-funding-row.js","names":[],"sources":["../../../src/quotes/get-quote-funding/to-funding-row.ts"],"sourcesContent":["import type { QuotesFundingQuery } from \"../../symmio-subgraph/types/generated/analytics/graphql\";\nimport type { QuoteFundingData } from \"./types\";\n\n/** A single `quotes` row as returned by the funding query. */\nexport type RawQuoteFundingRow = QuotesFundingQuery[\"quotes\"][number];\n\n/** Parse a wei string to `bigint`, defaulting null/undefined to `0n`. */\nfunction toBigInt(value: string | null | undefined): bigint {\n return value ? BigInt(value) : 0n;\n}\n\n/**\n * Build a {@link QuoteFundingData} from one raw subgraph `quotes` row.\n * `netReceived` is `received − paid`, so a positive value means the position\n * earned funding.\n */\nexport function toQuoteFundingRow(row: RawQuoteFundingRow): QuoteFundingData {\n const paid = toBigInt(row.userPaidFunding);\n const received = toBigInt(row.userReceivedFunding);\n return {\n quoteId: toBigInt(row.quoteId),\n paid,\n received,\n netReceived: received - paid,\n };\n}\n"],"mappings":";AAOA,SAAS,EAAS,GAA0C;CAC1D,OAAO,IAAQ,OAAO,CAAK,IAAI;AACjC;AAOA,SAAgB,EAAkB,GAA2C;CAC3E,IAAM,IAAO,EAAS,EAAI,eAAe,GACnC,IAAW,EAAS,EAAI,mBAAmB;CACjD,OAAO;EACL,SAAS,EAAS,EAAI,OAAO;EAC7B;EACA;EACA,aAAa,IAAW;CAC1B;AACF"}
1
+ {"version":3,"file":"to-funding-row.js","names":[],"sources":["../../../src/quotes/get-quote-funding/to-funding-row.ts"],"sourcesContent":["import { toBigIntOrZero } from \"../../symmio-subgraph/subgraph-decode\";\nimport type { QuotesFundingQuery } from \"../../symmio-subgraph/types/generated/analytics/graphql\";\nimport type { QuoteFundingData } from \"./types\";\n\n/** A single `quotes` row as returned by the funding query. */\nexport type RawQuoteFundingRow = QuotesFundingQuery[\"quotes\"][number];\n\n/**\n * Build a {@link QuoteFundingData} from one raw subgraph `quotes` row.\n * `netReceived` is `received − paid`, so a positive value means the position\n * earned funding.\n */\nexport function toQuoteFundingRow(row: RawQuoteFundingRow): QuoteFundingData {\n const paid = toBigIntOrZero(row.userPaidFunding);\n const received = toBigIntOrZero(row.userReceivedFunding);\n return {\n quoteId: toBigIntOrZero(row.quoteId),\n paid,\n received,\n netReceived: received - paid,\n };\n}\n"],"mappings":";;AAYA,SAAgB,EAAkB,GAA2C;CAC3E,IAAM,IAAO,EAAe,EAAI,eAAe,GACzC,IAAW,EAAe,EAAI,mBAAmB;CACvD,OAAO;EACL,SAAS,EAAe,EAAI,OAAO;EACnC;EACA;EACA,aAAa,IAAW;CAC1B;AACF"}
@@ -9,11 +9,12 @@ import { QuoteCloseType, QuoteHistoryRow } from './types.js';
9
9
  export type GetQuoteHistoryParameters = Compute<ChainIdParameter & {
10
10
  /**
11
11
  * The accounts whose history to read — a SubAccount and/or its Virtual
12
- * Accounts. Pass every account that may own the relevant quotes. Required; an
13
- * empty array reads nothing. All accounts in one call must share the
14
- * `isolationType` below (they select the same filter field).
12
+ * Accounts. Pass every account that may own the relevant quotes. Omit to read
13
+ * every account's history; an empty array reads nothing. All accounts in one
14
+ * call must share the `isolationType` below (they select the same filter
15
+ * field).
15
16
  */
16
- subAccounts: readonly Address[];
17
+ subAccounts?: readonly Address[];
17
18
  /**
18
19
  * The subaccount's isolation type, which picks the subgraph filter field:
19
20
  * `CUSTOM` (cross-margin) filters by `partyA` because those quotes carry no
@@ -21,6 +22,13 @@ export type GetQuoteHistoryParameters = Compute<ChainIdParameter & {
21
22
  * quote's `subAccount`. Omit for VA-isolation reads.
22
23
  */
23
24
  isolationType?: SubAccountIsolationType;
25
+ /**
26
+ * The deployment's diamond address (the subgraph's `source`). Omit to read
27
+ * every deployment the subgraph indexes.
28
+ */
29
+ source?: Address;
30
+ /** Market ids (`symbolId`) to read. Omit for every market; an empty array reads nothing. */
31
+ marketIds?: readonly number[];
24
32
  /** Close-type filter. @default QuoteCloseType.All */
25
33
  closeType?: QuoteCloseType;
26
34
  /** Page size. @default 50 */
@@ -45,11 +53,13 @@ export interface GetQuoteHistoryReturnType {
45
53
  *
46
54
  * Each row is one terminal event with its frozen `metadata` snapshot overlaid, so
47
55
  * a quote closed across multiple partial closes yields multiple, individually
48
- * accurate rows (see {@link "toQuoteHistoryRow"}). Filtering by close type, time
49
- * range, and pagination all happen server-side.
56
+ * accurate rows (see {@link "toQuoteHistoryRow"}). Filtering by account,
57
+ * deployment, market, close type, time range, and pagination all happen
58
+ * server-side. Account, deployment and market filters are optional and applied
59
+ * only when passed.
50
60
  *
51
61
  * @param config - The SDK config.
52
- * @param parameters - Accounts, optional close-type filter, pagination, time range, sort, chain id.
62
+ * @param parameters - Optional accounts, deployment, markets, close type, pagination, time range, sort, chain id.
53
63
  * @returns The history rows.
54
64
  * @throws {SymmError} when the chain is unsupported or has no analytics subgraph.
55
65
  * @throws {SymmApiError} when the subgraph request fails.
@@ -58,6 +68,7 @@ export interface GetQuoteHistoryReturnType {
58
68
  * ```ts
59
69
  * const { rows } = await getQuoteHistory(config, {
60
70
  * subAccounts: ["0xsub…"],
71
+ * source: "0xdiamond…",
61
72
  * closeType: QuoteCloseType.Liquidated,
62
73
  * first: 10,
63
74
  * });
@@ -1 +1 @@
1
- {"version":3,"file":"get-quote-history.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quote-history/get-quote-history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAMrF,OAAO,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAqB/D;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAC7C,gBAAgB,GAAG;IACjB;;;;;OAKG;IACH,WAAW,EAAE,SAAS,OAAO,EAAE,CAAC;IAChC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC,qDAAqD;IACrD,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,cAAc,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACjC,CACF,CAAC;AAEF,8CAA8C;AAC9C,MAAM,WAAW,yBAAyB;IACxC,oFAAoF;IACpF,IAAI,EAAE,eAAe,EAAE,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,yBAAyB,GACpC,OAAO,CAAC,yBAAyB,CAAC,CA8BpC"}
1
+ {"version":3,"file":"get-quote-history.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quote-history/get-quote-history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAOrF,OAAO,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAyB/D;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAC7C,gBAAgB,GAAG;IACjB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IACjC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,qDAAqD;IACrD,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,cAAc,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACjC,CACF,CAAC;AAEF,8CAA8C;AAC9C,MAAM,WAAW,yBAAyB;IACxC,oFAAoF;IACpF,IAAI,EAAE,eAAe,EAAE,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,yBAAyB,GACpC,OAAO,CAAC,yBAAyB,CAAC,CA8BpC"}