@compass-labs/api-sdk 2.2.19 → 2.2.20-rc.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 (334) hide show
  1. package/README.md +16 -1
  2. package/codeSamples_typescript.yaml +36 -0
  3. package/dist/commonjs/funcs/creditCreditBorrow.d.ts +25 -0
  4. package/dist/commonjs/funcs/creditCreditBorrow.d.ts.map +1 -0
  5. package/dist/commonjs/funcs/creditCreditBorrow.js +125 -0
  6. package/dist/commonjs/funcs/creditCreditBorrow.js.map +1 -0
  7. package/dist/commonjs/funcs/creditCreditBundle.d.ts +21 -0
  8. package/dist/commonjs/funcs/creditCreditBundle.d.ts.map +1 -0
  9. package/dist/commonjs/funcs/creditCreditBundle.js +121 -0
  10. package/dist/commonjs/funcs/creditCreditBundle.js.map +1 -0
  11. package/dist/commonjs/funcs/creditCreditCreateAccount.d.ts +26 -0
  12. package/dist/commonjs/funcs/creditCreditCreateAccount.d.ts.map +1 -0
  13. package/dist/commonjs/funcs/creditCreditCreateAccount.js +126 -0
  14. package/dist/commonjs/funcs/creditCreditCreateAccount.js.map +1 -0
  15. package/dist/commonjs/funcs/creditCreditPositions.d.ts +22 -0
  16. package/dist/commonjs/funcs/creditCreditPositions.d.ts.map +1 -0
  17. package/dist/commonjs/funcs/creditCreditPositions.js +126 -0
  18. package/dist/commonjs/funcs/creditCreditPositions.js.map +1 -0
  19. package/dist/commonjs/funcs/creditCreditRepay.d.ts +26 -0
  20. package/dist/commonjs/funcs/creditCreditRepay.d.ts.map +1 -0
  21. package/dist/commonjs/funcs/creditCreditRepay.js +126 -0
  22. package/dist/commonjs/funcs/creditCreditRepay.js.map +1 -0
  23. package/dist/commonjs/funcs/creditCreditTransfer.d.ts +27 -0
  24. package/dist/commonjs/funcs/creditCreditTransfer.d.ts.map +1 -0
  25. package/dist/commonjs/funcs/creditCreditTransfer.js +127 -0
  26. package/dist/commonjs/funcs/creditCreditTransfer.js.map +1 -0
  27. package/dist/commonjs/lib/config.d.ts +2 -2
  28. package/dist/commonjs/lib/config.js +2 -2
  29. package/dist/commonjs/models/components/accountsummary.d.ts +40 -0
  30. package/dist/commonjs/models/components/accountsummary.d.ts.map +1 -0
  31. package/dist/commonjs/models/components/accountsummary.js +66 -0
  32. package/dist/commonjs/models/components/accountsummary.js.map +1 -0
  33. package/dist/commonjs/models/components/borrowabletoken.d.ts +28 -0
  34. package/dist/commonjs/models/components/borrowabletoken.d.ts.map +1 -0
  35. package/dist/commonjs/models/components/borrowabletoken.js +59 -0
  36. package/dist/commonjs/models/components/borrowabletoken.js.map +1 -0
  37. package/dist/commonjs/models/components/collateralposition.d.ts +53 -0
  38. package/dist/commonjs/models/components/collateralposition.d.ts.map +1 -0
  39. package/dist/commonjs/models/components/collateralposition.js +71 -0
  40. package/dist/commonjs/models/components/collateralposition.js.map +1 -0
  41. package/dist/commonjs/models/components/createcreditaccountrequest.d.ts +39 -0
  42. package/dist/commonjs/models/components/createcreditaccountrequest.d.ts.map +1 -0
  43. package/dist/commonjs/models/components/createcreditaccountrequest.js +64 -0
  44. package/dist/commonjs/models/components/createcreditaccountrequest.js.map +1 -0
  45. package/dist/commonjs/models/components/createcreditaccountresponse.d.ts +21 -0
  46. package/dist/commonjs/models/components/createcreditaccountresponse.d.ts.map +1 -0
  47. package/dist/commonjs/models/components/createcreditaccountresponse.js +57 -0
  48. package/dist/commonjs/models/components/createcreditaccountresponse.js.map +1 -0
  49. package/dist/commonjs/models/components/creditborrowparams.d.ts +44 -0
  50. package/dist/commonjs/models/components/creditborrowparams.d.ts.map +1 -0
  51. package/dist/commonjs/models/components/creditborrowparams.js +65 -0
  52. package/dist/commonjs/models/components/creditborrowparams.js.map +1 -0
  53. package/dist/commonjs/models/components/creditborrowrequest.d.ts +108 -0
  54. package/dist/commonjs/models/components/creditborrowrequest.d.ts.map +1 -0
  55. package/dist/commonjs/models/components/creditborrowrequest.js +95 -0
  56. package/dist/commonjs/models/components/creditborrowrequest.js.map +1 -0
  57. package/dist/commonjs/models/components/creditborrowresponse.d.ts +23 -0
  58. package/dist/commonjs/models/components/creditborrowresponse.d.ts.map +1 -0
  59. package/dist/commonjs/models/components/creditborrowresponse.js +61 -0
  60. package/dist/commonjs/models/components/creditborrowresponse.js.map +1 -0
  61. package/dist/commonjs/models/components/creditbundlerequest.d.ts +35 -0
  62. package/dist/commonjs/models/components/creditbundlerequest.d.ts.map +1 -0
  63. package/dist/commonjs/models/components/creditbundlerequest.js +59 -0
  64. package/dist/commonjs/models/components/creditbundlerequest.js.map +1 -0
  65. package/dist/commonjs/models/components/creditbundleresponse.d.ts +23 -0
  66. package/dist/commonjs/models/components/creditbundleresponse.d.ts.map +1 -0
  67. package/dist/commonjs/models/components/creditbundleresponse.js +61 -0
  68. package/dist/commonjs/models/components/creditbundleresponse.js.map +1 -0
  69. package/dist/commonjs/models/components/creditevent.d.ts +53 -0
  70. package/dist/commonjs/models/components/creditevent.d.ts.map +1 -0
  71. package/dist/commonjs/models/components/creditevent.js +76 -0
  72. package/dist/commonjs/models/components/creditevent.js.map +1 -0
  73. package/dist/commonjs/models/components/creditpositionsresponse.d.ts +36 -0
  74. package/dist/commonjs/models/components/creditpositionsresponse.d.ts.map +1 -0
  75. package/dist/commonjs/models/components/creditpositionsresponse.js +67 -0
  76. package/dist/commonjs/models/components/creditpositionsresponse.js.map +1 -0
  77. package/dist/commonjs/models/components/creditrepayparams.d.ts +44 -0
  78. package/dist/commonjs/models/components/creditrepayparams.d.ts.map +1 -0
  79. package/dist/commonjs/models/components/creditrepayparams.js +65 -0
  80. package/dist/commonjs/models/components/creditrepayparams.js.map +1 -0
  81. package/dist/commonjs/models/components/creditrepayrequest.d.ts +108 -0
  82. package/dist/commonjs/models/components/creditrepayrequest.d.ts.map +1 -0
  83. package/dist/commonjs/models/components/creditrepayrequest.js +95 -0
  84. package/dist/commonjs/models/components/creditrepayrequest.js.map +1 -0
  85. package/dist/commonjs/models/components/creditrepayresponse.d.ts +23 -0
  86. package/dist/commonjs/models/components/creditrepayresponse.d.ts.map +1 -0
  87. package/dist/commonjs/models/components/creditrepayresponse.js +61 -0
  88. package/dist/commonjs/models/components/creditrepayresponse.js.map +1 -0
  89. package/dist/commonjs/models/components/creditsupplyparams.d.ts +34 -0
  90. package/dist/commonjs/models/components/creditsupplyparams.d.ts.map +1 -0
  91. package/dist/commonjs/models/components/creditsupplyparams.js +62 -0
  92. package/dist/commonjs/models/components/creditsupplyparams.js.map +1 -0
  93. package/dist/commonjs/models/components/credittransferrequest.d.ts +40 -0
  94. package/dist/commonjs/models/components/credittransferrequest.d.ts.map +1 -0
  95. package/dist/commonjs/models/components/credittransferrequest.js +59 -0
  96. package/dist/commonjs/models/components/credittransferrequest.js.map +1 -0
  97. package/dist/commonjs/models/components/credittransferresponse.d.ts +11 -0
  98. package/dist/commonjs/models/components/credittransferresponse.d.ts.map +1 -0
  99. package/dist/commonjs/models/components/credittransferresponse.js +56 -0
  100. package/dist/commonjs/models/components/credittransferresponse.js.map +1 -0
  101. package/dist/commonjs/models/components/credituseroperation.d.ts +28 -0
  102. package/dist/commonjs/models/components/credituseroperation.d.ts.map +1 -0
  103. package/dist/commonjs/models/components/credituseroperation.js +78 -0
  104. package/dist/commonjs/models/components/credituseroperation.js.map +1 -0
  105. package/dist/commonjs/models/components/creditwithdrawparams.d.ts +34 -0
  106. package/dist/commonjs/models/components/creditwithdrawparams.d.ts.map +1 -0
  107. package/dist/commonjs/models/components/creditwithdrawparams.js +62 -0
  108. package/dist/commonjs/models/components/creditwithdrawparams.js.map +1 -0
  109. package/dist/commonjs/models/components/debtposition.d.ts +49 -0
  110. package/dist/commonjs/models/components/debtposition.d.ts.map +1 -0
  111. package/dist/commonjs/models/components/debtposition.js +69 -0
  112. package/dist/commonjs/models/components/debtposition.js.map +1 -0
  113. package/dist/commonjs/models/components/index.d.ts +21 -0
  114. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  115. package/dist/commonjs/models/components/index.js +21 -0
  116. package/dist/commonjs/models/components/index.js.map +1 -1
  117. package/dist/commonjs/models/operations/index.d.ts +1 -0
  118. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  119. package/dist/commonjs/models/operations/index.js +1 -0
  120. package/dist/commonjs/models/operations/index.js.map +1 -1
  121. package/dist/commonjs/models/operations/v2creditpositions.d.ts +26 -0
  122. package/dist/commonjs/models/operations/v2creditpositions.d.ts.map +1 -0
  123. package/dist/commonjs/models/operations/v2creditpositions.js +57 -0
  124. package/dist/commonjs/models/operations/v2creditpositions.js.map +1 -0
  125. package/dist/commonjs/sdk/credit.d.ts +86 -0
  126. package/dist/commonjs/sdk/credit.d.ts.map +1 -0
  127. package/dist/commonjs/sdk/credit.js +110 -0
  128. package/dist/commonjs/sdk/credit.js.map +1 -0
  129. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  130. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  131. package/dist/commonjs/sdk/sdk.js +4 -0
  132. package/dist/commonjs/sdk/sdk.js.map +1 -1
  133. package/dist/esm/funcs/creditCreditBorrow.d.ts +25 -0
  134. package/dist/esm/funcs/creditCreditBorrow.d.ts.map +1 -0
  135. package/dist/esm/funcs/creditCreditBorrow.js +89 -0
  136. package/dist/esm/funcs/creditCreditBorrow.js.map +1 -0
  137. package/dist/esm/funcs/creditCreditBundle.d.ts +21 -0
  138. package/dist/esm/funcs/creditCreditBundle.d.ts.map +1 -0
  139. package/dist/esm/funcs/creditCreditBundle.js +85 -0
  140. package/dist/esm/funcs/creditCreditBundle.js.map +1 -0
  141. package/dist/esm/funcs/creditCreditCreateAccount.d.ts +26 -0
  142. package/dist/esm/funcs/creditCreditCreateAccount.d.ts.map +1 -0
  143. package/dist/esm/funcs/creditCreditCreateAccount.js +90 -0
  144. package/dist/esm/funcs/creditCreditCreateAccount.js.map +1 -0
  145. package/dist/esm/funcs/creditCreditPositions.d.ts +22 -0
  146. package/dist/esm/funcs/creditCreditPositions.d.ts.map +1 -0
  147. package/dist/esm/funcs/creditCreditPositions.js +90 -0
  148. package/dist/esm/funcs/creditCreditPositions.js.map +1 -0
  149. package/dist/esm/funcs/creditCreditRepay.d.ts +26 -0
  150. package/dist/esm/funcs/creditCreditRepay.d.ts.map +1 -0
  151. package/dist/esm/funcs/creditCreditRepay.js +90 -0
  152. package/dist/esm/funcs/creditCreditRepay.js.map +1 -0
  153. package/dist/esm/funcs/creditCreditTransfer.d.ts +27 -0
  154. package/dist/esm/funcs/creditCreditTransfer.d.ts.map +1 -0
  155. package/dist/esm/funcs/creditCreditTransfer.js +91 -0
  156. package/dist/esm/funcs/creditCreditTransfer.js.map +1 -0
  157. package/dist/esm/lib/config.d.ts +2 -2
  158. package/dist/esm/lib/config.js +2 -2
  159. package/dist/esm/models/components/accountsummary.d.ts +40 -0
  160. package/dist/esm/models/components/accountsummary.d.ts.map +1 -0
  161. package/dist/esm/models/components/accountsummary.js +29 -0
  162. package/dist/esm/models/components/accountsummary.js.map +1 -0
  163. package/dist/esm/models/components/borrowabletoken.d.ts +28 -0
  164. package/dist/esm/models/components/borrowabletoken.d.ts.map +1 -0
  165. package/dist/esm/models/components/borrowabletoken.js +22 -0
  166. package/dist/esm/models/components/borrowabletoken.js.map +1 -0
  167. package/dist/esm/models/components/collateralposition.d.ts +53 -0
  168. package/dist/esm/models/components/collateralposition.d.ts.map +1 -0
  169. package/dist/esm/models/components/collateralposition.js +34 -0
  170. package/dist/esm/models/components/collateralposition.js.map +1 -0
  171. package/dist/esm/models/components/createcreditaccountrequest.d.ts +39 -0
  172. package/dist/esm/models/components/createcreditaccountrequest.d.ts.map +1 -0
  173. package/dist/esm/models/components/createcreditaccountrequest.js +27 -0
  174. package/dist/esm/models/components/createcreditaccountrequest.js.map +1 -0
  175. package/dist/esm/models/components/createcreditaccountresponse.d.ts +21 -0
  176. package/dist/esm/models/components/createcreditaccountresponse.d.ts.map +1 -0
  177. package/dist/esm/models/components/createcreditaccountresponse.js +20 -0
  178. package/dist/esm/models/components/createcreditaccountresponse.js.map +1 -0
  179. package/dist/esm/models/components/creditborrowparams.d.ts +44 -0
  180. package/dist/esm/models/components/creditborrowparams.d.ts.map +1 -0
  181. package/dist/esm/models/components/creditborrowparams.js +27 -0
  182. package/dist/esm/models/components/creditborrowparams.js.map +1 -0
  183. package/dist/esm/models/components/creditborrowrequest.d.ts +108 -0
  184. package/dist/esm/models/components/creditborrowrequest.d.ts.map +1 -0
  185. package/dist/esm/models/components/creditborrowrequest.js +55 -0
  186. package/dist/esm/models/components/creditborrowrequest.js.map +1 -0
  187. package/dist/esm/models/components/creditborrowresponse.d.ts +23 -0
  188. package/dist/esm/models/components/creditborrowresponse.d.ts.map +1 -0
  189. package/dist/esm/models/components/creditborrowresponse.js +24 -0
  190. package/dist/esm/models/components/creditborrowresponse.js.map +1 -0
  191. package/dist/esm/models/components/creditbundlerequest.d.ts +35 -0
  192. package/dist/esm/models/components/creditbundlerequest.d.ts.map +1 -0
  193. package/dist/esm/models/components/creditbundlerequest.js +22 -0
  194. package/dist/esm/models/components/creditbundlerequest.js.map +1 -0
  195. package/dist/esm/models/components/creditbundleresponse.d.ts +23 -0
  196. package/dist/esm/models/components/creditbundleresponse.d.ts.map +1 -0
  197. package/dist/esm/models/components/creditbundleresponse.js +24 -0
  198. package/dist/esm/models/components/creditbundleresponse.js.map +1 -0
  199. package/dist/esm/models/components/creditevent.d.ts +53 -0
  200. package/dist/esm/models/components/creditevent.d.ts.map +1 -0
  201. package/dist/esm/models/components/creditevent.js +39 -0
  202. package/dist/esm/models/components/creditevent.js.map +1 -0
  203. package/dist/esm/models/components/creditpositionsresponse.d.ts +36 -0
  204. package/dist/esm/models/components/creditpositionsresponse.d.ts.map +1 -0
  205. package/dist/esm/models/components/creditpositionsresponse.js +30 -0
  206. package/dist/esm/models/components/creditpositionsresponse.js.map +1 -0
  207. package/dist/esm/models/components/creditrepayparams.d.ts +44 -0
  208. package/dist/esm/models/components/creditrepayparams.d.ts.map +1 -0
  209. package/dist/esm/models/components/creditrepayparams.js +27 -0
  210. package/dist/esm/models/components/creditrepayparams.js.map +1 -0
  211. package/dist/esm/models/components/creditrepayrequest.d.ts +108 -0
  212. package/dist/esm/models/components/creditrepayrequest.d.ts.map +1 -0
  213. package/dist/esm/models/components/creditrepayrequest.js +55 -0
  214. package/dist/esm/models/components/creditrepayrequest.js.map +1 -0
  215. package/dist/esm/models/components/creditrepayresponse.d.ts +23 -0
  216. package/dist/esm/models/components/creditrepayresponse.d.ts.map +1 -0
  217. package/dist/esm/models/components/creditrepayresponse.js +24 -0
  218. package/dist/esm/models/components/creditrepayresponse.js.map +1 -0
  219. package/dist/esm/models/components/creditsupplyparams.d.ts +34 -0
  220. package/dist/esm/models/components/creditsupplyparams.d.ts.map +1 -0
  221. package/dist/esm/models/components/creditsupplyparams.js +24 -0
  222. package/dist/esm/models/components/creditsupplyparams.js.map +1 -0
  223. package/dist/esm/models/components/credittransferrequest.d.ts +40 -0
  224. package/dist/esm/models/components/credittransferrequest.d.ts.map +1 -0
  225. package/dist/esm/models/components/credittransferrequest.js +21 -0
  226. package/dist/esm/models/components/credittransferrequest.js.map +1 -0
  227. package/dist/esm/models/components/credittransferresponse.d.ts +11 -0
  228. package/dist/esm/models/components/credittransferresponse.d.ts.map +1 -0
  229. package/dist/esm/models/components/credittransferresponse.js +19 -0
  230. package/dist/esm/models/components/credittransferresponse.js.map +1 -0
  231. package/dist/esm/models/components/credituseroperation.d.ts +28 -0
  232. package/dist/esm/models/components/credituseroperation.d.ts.map +1 -0
  233. package/dist/esm/models/components/credituseroperation.js +40 -0
  234. package/dist/esm/models/components/credituseroperation.js.map +1 -0
  235. package/dist/esm/models/components/creditwithdrawparams.d.ts +34 -0
  236. package/dist/esm/models/components/creditwithdrawparams.d.ts.map +1 -0
  237. package/dist/esm/models/components/creditwithdrawparams.js +24 -0
  238. package/dist/esm/models/components/creditwithdrawparams.js.map +1 -0
  239. package/dist/esm/models/components/debtposition.d.ts +49 -0
  240. package/dist/esm/models/components/debtposition.d.ts.map +1 -0
  241. package/dist/esm/models/components/debtposition.js +32 -0
  242. package/dist/esm/models/components/debtposition.js.map +1 -0
  243. package/dist/esm/models/components/index.d.ts +21 -0
  244. package/dist/esm/models/components/index.d.ts.map +1 -1
  245. package/dist/esm/models/components/index.js +21 -0
  246. package/dist/esm/models/components/index.js.map +1 -1
  247. package/dist/esm/models/operations/index.d.ts +1 -0
  248. package/dist/esm/models/operations/index.d.ts.map +1 -1
  249. package/dist/esm/models/operations/index.js +1 -0
  250. package/dist/esm/models/operations/index.js.map +1 -1
  251. package/dist/esm/models/operations/v2creditpositions.d.ts +26 -0
  252. package/dist/esm/models/operations/v2creditpositions.d.ts.map +1 -0
  253. package/dist/esm/models/operations/v2creditpositions.js +20 -0
  254. package/dist/esm/models/operations/v2creditpositions.js.map +1 -0
  255. package/dist/esm/sdk/credit.d.ts +86 -0
  256. package/dist/esm/sdk/credit.d.ts.map +1 -0
  257. package/dist/esm/sdk/credit.js +106 -0
  258. package/dist/esm/sdk/credit.js.map +1 -0
  259. package/dist/esm/sdk/sdk.d.ts +3 -0
  260. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  261. package/dist/esm/sdk/sdk.js +4 -0
  262. package/dist/esm/sdk/sdk.js.map +1 -1
  263. package/docs/models/components/accountsummary.md +30 -0
  264. package/docs/models/components/borrowabletoken.md +25 -0
  265. package/docs/models/components/borrowamount.md +19 -0
  266. package/docs/models/components/collateralposition.md +31 -0
  267. package/docs/models/components/createcreditaccountrequest.md +24 -0
  268. package/docs/models/components/createcreditaccountrequestchain.md +15 -0
  269. package/docs/models/components/createcreditaccountresponse.md +31 -0
  270. package/docs/models/components/creditborrowparams.md +24 -0
  271. package/docs/models/components/creditborrowparamsamount.md +19 -0
  272. package/docs/models/components/creditborrowrequest.md +38 -0
  273. package/docs/models/components/creditborrowrequestamountin.md +19 -0
  274. package/docs/models/components/creditborrowrequestslippage.md +19 -0
  275. package/docs/models/components/creditborrowresponse.md +17 -0
  276. package/docs/models/components/creditbundlerequest.md +25 -0
  277. package/docs/models/components/creditbundleresponse.md +19 -0
  278. package/docs/models/components/creditevent.md +29 -0
  279. package/docs/models/components/creditpositionsresponse.md +33 -0
  280. package/docs/models/components/creditrepayparams.md +24 -0
  281. package/docs/models/components/creditrepayparamsamount.md +19 -0
  282. package/docs/models/components/creditrepayrequest.md +37 -0
  283. package/docs/models/components/creditrepayrequestslippage.md +19 -0
  284. package/docs/models/components/creditrepayresponse.md +17 -0
  285. package/docs/models/components/creditsupplyparams.md +23 -0
  286. package/docs/models/components/creditsupplyparamsamount.md +19 -0
  287. package/docs/models/components/credittransferrequest.md +23 -0
  288. package/docs/models/components/credittransferrequestamount.md +19 -0
  289. package/docs/models/components/credittransferresponse.md +75 -0
  290. package/docs/models/components/credituseroperation.md +23 -0
  291. package/docs/models/components/credituseroperationbody.md +80 -0
  292. package/docs/models/components/creditwithdrawparams.md +23 -0
  293. package/docs/models/components/creditwithdrawparamsamount.md +19 -0
  294. package/docs/models/components/debtposition.md +30 -0
  295. package/docs/models/components/eventtype.md +17 -0
  296. package/docs/models/components/repayamount.md +19 -0
  297. package/docs/models/components/withdrawamount.md +19 -0
  298. package/docs/models/operations/v2creditpositionschain.md +15 -0
  299. package/docs/models/operations/v2creditpositionsrequest.md +19 -0
  300. package/docs/sdks/credit/README.md +562 -0
  301. package/package.json +1 -1
  302. package/src/funcs/creditCreditBorrow.ts +176 -0
  303. package/src/funcs/creditCreditBundle.ts +172 -0
  304. package/src/funcs/creditCreditCreateAccount.ts +178 -0
  305. package/src/funcs/creditCreditPositions.ts +178 -0
  306. package/src/funcs/creditCreditRepay.ts +177 -0
  307. package/src/funcs/creditCreditTransfer.ts +178 -0
  308. package/src/lib/config.ts +2 -2
  309. package/src/models/components/accountsummary.ts +77 -0
  310. package/src/models/components/borrowabletoken.ts +58 -0
  311. package/src/models/components/collateralposition.ts +94 -0
  312. package/src/models/components/createcreditaccountrequest.ts +72 -0
  313. package/src/models/components/createcreditaccountresponse.ts +51 -0
  314. package/src/models/components/creditborrowparams.ts +89 -0
  315. package/src/models/components/creditborrowrequest.ts +198 -0
  316. package/src/models/components/creditborrowresponse.ts +59 -0
  317. package/src/models/components/creditbundlerequest.ts +66 -0
  318. package/src/models/components/creditbundleresponse.ts +59 -0
  319. package/src/models/components/creditevent.ts +92 -0
  320. package/src/models/components/creditpositionsresponse.ts +79 -0
  321. package/src/models/components/creditrepayparams.ts +89 -0
  322. package/src/models/components/creditrepayrequest.ts +190 -0
  323. package/src/models/components/creditrepayresponse.ts +59 -0
  324. package/src/models/components/creditsupplyparams.ts +74 -0
  325. package/src/models/components/credittransferrequest.ts +78 -0
  326. package/src/models/components/credittransferresponse.ts +40 -0
  327. package/src/models/components/credituseroperation.ts +133 -0
  328. package/src/models/components/creditwithdrawparams.ts +74 -0
  329. package/src/models/components/debtposition.ts +88 -0
  330. package/src/models/components/index.ts +21 -0
  331. package/src/models/operations/index.ts +1 -0
  332. package/src/models/operations/v2creditpositions.ts +50 -0
  333. package/src/sdk/credit.ts +156 -0
  334. package/src/sdk/sdk.ts +6 -0
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import {
11
+ UnsignedTransaction,
12
+ UnsignedTransaction$inboundSchema,
13
+ } from "./unsignedtransaction.js";
14
+
15
+ /**
16
+ * Response containing unsigned transaction to create compass Credit account.
17
+ */
18
+ export type CreateCreditAccountResponse = {
19
+ /**
20
+ * Transaction to create compass credit account
21
+ */
22
+ transaction: UnsignedTransaction | null;
23
+ /**
24
+ * Predicted address of the compass credit account that will be deployed
25
+ */
26
+ creditAccountAddress: string;
27
+ };
28
+
29
+ /** @internal */
30
+ export const CreateCreditAccountResponse$inboundSchema: z.ZodType<
31
+ CreateCreditAccountResponse,
32
+ z.ZodTypeDef,
33
+ unknown
34
+ > = z.object({
35
+ transaction: z.nullable(UnsignedTransaction$inboundSchema),
36
+ credit_account_address: z.string(),
37
+ }).transform((v) => {
38
+ return remap$(v, {
39
+ "credit_account_address": "creditAccountAddress",
40
+ });
41
+ });
42
+
43
+ export function createCreditAccountResponseFromJSON(
44
+ jsonString: string,
45
+ ): SafeParseResult<CreateCreditAccountResponse, SDKValidationError> {
46
+ return safeParse(
47
+ jsonString,
48
+ (x) => CreateCreditAccountResponse$inboundSchema.parse(JSON.parse(x)),
49
+ `Failed to parse 'CreateCreditAccountResponse' from JSON`,
50
+ );
51
+ }
@@ -0,0 +1,89 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import {
8
+ InterestRateMode,
9
+ InterestRateMode$outboundSchema,
10
+ } from "./interestratemode.js";
11
+
12
+ /**
13
+ * Amount in token units to borrow.
14
+ */
15
+ export type CreditBorrowParamsAmount = number | string;
16
+
17
+ /**
18
+ * Borrow from Aave via Credit Account.
19
+ */
20
+ export type CreditBorrowParams = {
21
+ actionType: "CREDIT_BORROW";
22
+ /**
23
+ * Token to borrow from Aave.
24
+ */
25
+ token: string;
26
+ /**
27
+ * Amount in token units to borrow.
28
+ */
29
+ amount: number | string;
30
+ /**
31
+ * On AAVE there are 2 different interest modes.
32
+ *
33
+ * @remarks
34
+ *
35
+ * A stable (but typically higher rate), or a variable rate.
36
+ */
37
+ interestRateMode?: InterestRateMode | undefined;
38
+ };
39
+
40
+ /** @internal */
41
+ export type CreditBorrowParamsAmount$Outbound = number | string;
42
+
43
+ /** @internal */
44
+ export const CreditBorrowParamsAmount$outboundSchema: z.ZodType<
45
+ CreditBorrowParamsAmount$Outbound,
46
+ z.ZodTypeDef,
47
+ CreditBorrowParamsAmount
48
+ > = z.union([z.number(), z.string()]);
49
+
50
+ export function creditBorrowParamsAmountToJSON(
51
+ creditBorrowParamsAmount: CreditBorrowParamsAmount,
52
+ ): string {
53
+ return JSON.stringify(
54
+ CreditBorrowParamsAmount$outboundSchema.parse(creditBorrowParamsAmount),
55
+ );
56
+ }
57
+
58
+ /** @internal */
59
+ export type CreditBorrowParams$Outbound = {
60
+ action_type: "CREDIT_BORROW";
61
+ token: string;
62
+ amount: number | string;
63
+ interest_rate_mode?: string | undefined;
64
+ };
65
+
66
+ /** @internal */
67
+ export const CreditBorrowParams$outboundSchema: z.ZodType<
68
+ CreditBorrowParams$Outbound,
69
+ z.ZodTypeDef,
70
+ CreditBorrowParams
71
+ > = z.object({
72
+ actionType: z.literal("CREDIT_BORROW"),
73
+ token: z.string(),
74
+ amount: z.union([z.number(), z.string()]),
75
+ interestRateMode: InterestRateMode$outboundSchema.optional(),
76
+ }).transform((v) => {
77
+ return remap$(v, {
78
+ actionType: "action_type",
79
+ interestRateMode: "interest_rate_mode",
80
+ });
81
+ });
82
+
83
+ export function creditBorrowParamsToJSON(
84
+ creditBorrowParams: CreditBorrowParams,
85
+ ): string {
86
+ return JSON.stringify(
87
+ CreditBorrowParams$outboundSchema.parse(creditBorrowParams),
88
+ );
89
+ }
@@ -0,0 +1,198 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { Chain, Chain$outboundSchema } from "./chain.js";
8
+ import {
9
+ InterestRateMode,
10
+ InterestRateMode$outboundSchema,
11
+ } from "./interestratemode.js";
12
+
13
+ /**
14
+ * Amount of token_in to use (in token units, not wei).
15
+ */
16
+ export type CreditBorrowRequestAmountIn = number | string;
17
+
18
+ /**
19
+ * Amount to borrow (in token units, not wei).
20
+ */
21
+ export type BorrowAmount = number | string;
22
+
23
+ /**
24
+ * Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%). Only used when a swap is needed.
25
+ */
26
+ export type CreditBorrowRequestSlippage = number | string;
27
+
28
+ export type CreditBorrowRequest = {
29
+ /**
30
+ * The address that owns the Credit Account.
31
+ */
32
+ owner: string;
33
+ /**
34
+ * The chain to use.
35
+ */
36
+ chain: Chain;
37
+ /**
38
+ * Token currently held in the Credit Account to use as input. If the same as collateral_token, no swap is performed.
39
+ */
40
+ tokenIn: string;
41
+ /**
42
+ * Amount of token_in to use (in token units, not wei).
43
+ */
44
+ amountIn: number | string;
45
+ /**
46
+ * Aave reserve token to supply as collateral.
47
+ */
48
+ collateralToken: string;
49
+ /**
50
+ * Asset to borrow from Aave.
51
+ */
52
+ borrowToken: string;
53
+ /**
54
+ * Amount to borrow (in token units, not wei).
55
+ */
56
+ borrowAmount: number | string;
57
+ /**
58
+ * On AAVE there are 2 different interest modes.
59
+ *
60
+ * @remarks
61
+ *
62
+ * A stable (but typically higher rate), or a variable rate.
63
+ */
64
+ interestRateMode?: InterestRateMode | undefined;
65
+ /**
66
+ * Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%). Only used when a swap is needed.
67
+ */
68
+ slippage?: number | string | undefined;
69
+ /**
70
+ * If true, returns EIP-712 signature data instead of an unsigned transaction.
71
+ */
72
+ gasSponsorship?: boolean | undefined;
73
+ /**
74
+ * The EOA owner's signature of the Permit2 PermitTransferFrom typed data. When provided, the borrow bundle will first pull token_in from the owner's EOA into the Credit Account via Permit2. Obtain by calling /v2/credit/transfer and signing the returned EIP-712 data.
75
+ */
76
+ permit2Signature?: string | null | undefined;
77
+ /**
78
+ * The nonce used in the Permit2 signature (from the signed typed data).
79
+ */
80
+ permit2Nonce?: number | null | undefined;
81
+ /**
82
+ * The deadline timestamp used in the Permit2 signature (from the signed typed data).
83
+ */
84
+ permit2Deadline?: number | null | undefined;
85
+ };
86
+
87
+ /** @internal */
88
+ export type CreditBorrowRequestAmountIn$Outbound = number | string;
89
+
90
+ /** @internal */
91
+ export const CreditBorrowRequestAmountIn$outboundSchema: z.ZodType<
92
+ CreditBorrowRequestAmountIn$Outbound,
93
+ z.ZodTypeDef,
94
+ CreditBorrowRequestAmountIn
95
+ > = z.union([z.number(), z.string()]);
96
+
97
+ export function creditBorrowRequestAmountInToJSON(
98
+ creditBorrowRequestAmountIn: CreditBorrowRequestAmountIn,
99
+ ): string {
100
+ return JSON.stringify(
101
+ CreditBorrowRequestAmountIn$outboundSchema.parse(
102
+ creditBorrowRequestAmountIn,
103
+ ),
104
+ );
105
+ }
106
+
107
+ /** @internal */
108
+ export type BorrowAmount$Outbound = number | string;
109
+
110
+ /** @internal */
111
+ export const BorrowAmount$outboundSchema: z.ZodType<
112
+ BorrowAmount$Outbound,
113
+ z.ZodTypeDef,
114
+ BorrowAmount
115
+ > = z.union([z.number(), z.string()]);
116
+
117
+ export function borrowAmountToJSON(borrowAmount: BorrowAmount): string {
118
+ return JSON.stringify(BorrowAmount$outboundSchema.parse(borrowAmount));
119
+ }
120
+
121
+ /** @internal */
122
+ export type CreditBorrowRequestSlippage$Outbound = number | string;
123
+
124
+ /** @internal */
125
+ export const CreditBorrowRequestSlippage$outboundSchema: z.ZodType<
126
+ CreditBorrowRequestSlippage$Outbound,
127
+ z.ZodTypeDef,
128
+ CreditBorrowRequestSlippage
129
+ > = z.union([z.number(), z.string()]);
130
+
131
+ export function creditBorrowRequestSlippageToJSON(
132
+ creditBorrowRequestSlippage: CreditBorrowRequestSlippage,
133
+ ): string {
134
+ return JSON.stringify(
135
+ CreditBorrowRequestSlippage$outboundSchema.parse(
136
+ creditBorrowRequestSlippage,
137
+ ),
138
+ );
139
+ }
140
+
141
+ /** @internal */
142
+ export type CreditBorrowRequest$Outbound = {
143
+ owner: string;
144
+ chain: string;
145
+ token_in: string;
146
+ amount_in: number | string;
147
+ collateral_token: string;
148
+ borrow_token: string;
149
+ borrow_amount: number | string;
150
+ interest_rate_mode?: string | undefined;
151
+ slippage?: number | string | undefined;
152
+ gas_sponsorship?: boolean | undefined;
153
+ permit2_signature?: string | null | undefined;
154
+ permit2_nonce?: number | null | undefined;
155
+ permit2_deadline?: number | null | undefined;
156
+ };
157
+
158
+ /** @internal */
159
+ export const CreditBorrowRequest$outboundSchema: z.ZodType<
160
+ CreditBorrowRequest$Outbound,
161
+ z.ZodTypeDef,
162
+ CreditBorrowRequest
163
+ > = z.object({
164
+ owner: z.string(),
165
+ chain: Chain$outboundSchema,
166
+ tokenIn: z.string(),
167
+ amountIn: z.union([z.number(), z.string()]),
168
+ collateralToken: z.string(),
169
+ borrowToken: z.string(),
170
+ borrowAmount: z.union([z.number(), z.string()]),
171
+ interestRateMode: InterestRateMode$outboundSchema.optional(),
172
+ slippage: z.union([z.number(), z.string()]).optional(),
173
+ gasSponsorship: z.boolean().optional(),
174
+ permit2Signature: z.nullable(z.string()).optional(),
175
+ permit2Nonce: z.nullable(z.number().int()).optional(),
176
+ permit2Deadline: z.nullable(z.number().int()).optional(),
177
+ }).transform((v) => {
178
+ return remap$(v, {
179
+ tokenIn: "token_in",
180
+ amountIn: "amount_in",
181
+ collateralToken: "collateral_token",
182
+ borrowToken: "borrow_token",
183
+ borrowAmount: "borrow_amount",
184
+ interestRateMode: "interest_rate_mode",
185
+ gasSponsorship: "gas_sponsorship",
186
+ permit2Signature: "permit2_signature",
187
+ permit2Nonce: "permit2_nonce",
188
+ permit2Deadline: "permit2_deadline",
189
+ });
190
+ });
191
+
192
+ export function creditBorrowRequestToJSON(
193
+ creditBorrowRequest: CreditBorrowRequest,
194
+ ): string {
195
+ return JSON.stringify(
196
+ CreditBorrowRequest$outboundSchema.parse(creditBorrowRequest),
197
+ );
198
+ }
@@ -0,0 +1,59 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import {
11
+ BatchedSafeOperationsResponseOutput,
12
+ BatchedSafeOperationsResponseOutput$inboundSchema,
13
+ } from "./batchedsafeoperationsresponseoutput.js";
14
+ import {
15
+ UnsignedTransaction,
16
+ UnsignedTransaction$inboundSchema,
17
+ } from "./unsignedtransaction.js";
18
+
19
+ export type CreditBorrowResponse = {
20
+ /**
21
+ * Unsigned transaction to execute the borrow bundle. Present when gas_sponsorship is false.
22
+ */
23
+ transaction?: UnsignedTransaction | null | undefined;
24
+ /**
25
+ * EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship is true.
26
+ */
27
+ eip712?: BatchedSafeOperationsResponseOutput | null | undefined;
28
+ /**
29
+ * Estimated amount of collateral token received from swap. Only present when token_in differs from collateral_token.
30
+ */
31
+ estimatedCollateralAmount?: string | null | undefined;
32
+ };
33
+
34
+ /** @internal */
35
+ export const CreditBorrowResponse$inboundSchema: z.ZodType<
36
+ CreditBorrowResponse,
37
+ z.ZodTypeDef,
38
+ unknown
39
+ > = z.object({
40
+ transaction: z.nullable(UnsignedTransaction$inboundSchema).optional(),
41
+ eip_712: z.nullable(BatchedSafeOperationsResponseOutput$inboundSchema)
42
+ .optional(),
43
+ estimated_collateral_amount: z.nullable(z.string()).optional(),
44
+ }).transform((v) => {
45
+ return remap$(v, {
46
+ "eip_712": "eip712",
47
+ "estimated_collateral_amount": "estimatedCollateralAmount",
48
+ });
49
+ });
50
+
51
+ export function creditBorrowResponseFromJSON(
52
+ jsonString: string,
53
+ ): SafeParseResult<CreditBorrowResponse, SDKValidationError> {
54
+ return safeParse(
55
+ jsonString,
56
+ (x) => CreditBorrowResponse$inboundSchema.parse(JSON.parse(x)),
57
+ `Failed to parse 'CreditBorrowResponse' from JSON`,
58
+ );
59
+ }
@@ -0,0 +1,66 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { Chain, Chain$outboundSchema } from "./chain.js";
8
+ import {
9
+ CreditUserOperation,
10
+ CreditUserOperation$Outbound,
11
+ CreditUserOperation$outboundSchema,
12
+ } from "./credituseroperation.js";
13
+
14
+ /**
15
+ * Request to execute multiple credit actions in a single atomic transaction.
16
+ */
17
+ export type CreditBundleRequest = {
18
+ /**
19
+ * The owner's wallet address that controls the Credit Account.
20
+ */
21
+ owner: string;
22
+ /**
23
+ * The chain to use.
24
+ */
25
+ chain: Chain;
26
+ /**
27
+ * List of actions to bundle. Actions are executed in order.
28
+ */
29
+ actions: Array<CreditUserOperation>;
30
+ /**
31
+ * If true, returns EIP-712 typed data for gas-sponsored execution.
32
+ */
33
+ gasSponsorship?: boolean | undefined;
34
+ };
35
+
36
+ /** @internal */
37
+ export type CreditBundleRequest$Outbound = {
38
+ owner: string;
39
+ chain: string;
40
+ actions: Array<CreditUserOperation$Outbound>;
41
+ gas_sponsorship?: boolean | undefined;
42
+ };
43
+
44
+ /** @internal */
45
+ export const CreditBundleRequest$outboundSchema: z.ZodType<
46
+ CreditBundleRequest$Outbound,
47
+ z.ZodTypeDef,
48
+ CreditBundleRequest
49
+ > = z.object({
50
+ owner: z.string(),
51
+ chain: Chain$outboundSchema,
52
+ actions: z.array(CreditUserOperation$outboundSchema),
53
+ gasSponsorship: z.boolean().optional(),
54
+ }).transform((v) => {
55
+ return remap$(v, {
56
+ gasSponsorship: "gas_sponsorship",
57
+ });
58
+ });
59
+
60
+ export function creditBundleRequestToJSON(
61
+ creditBundleRequest: CreditBundleRequest,
62
+ ): string {
63
+ return JSON.stringify(
64
+ CreditBundleRequest$outboundSchema.parse(creditBundleRequest),
65
+ );
66
+ }
@@ -0,0 +1,59 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import {
11
+ BatchedSafeOperationsResponseOutput,
12
+ BatchedSafeOperationsResponseOutput$inboundSchema,
13
+ } from "./batchedsafeoperationsresponseoutput.js";
14
+ import {
15
+ UnsignedTransaction,
16
+ UnsignedTransaction$inboundSchema,
17
+ } from "./unsignedtransaction.js";
18
+
19
+ export type CreditBundleResponse = {
20
+ /**
21
+ * Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false.
22
+ */
23
+ transaction?: UnsignedTransaction | null | undefined;
24
+ /**
25
+ * EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true. Owner must sign and submit to /gas_sponsorship/prepare.
26
+ */
27
+ eip712?: BatchedSafeOperationsResponseOutput | null | undefined;
28
+ /**
29
+ * Number of individual transactions bundled in this execution.
30
+ */
31
+ actionsCount: number;
32
+ };
33
+
34
+ /** @internal */
35
+ export const CreditBundleResponse$inboundSchema: z.ZodType<
36
+ CreditBundleResponse,
37
+ z.ZodTypeDef,
38
+ unknown
39
+ > = z.object({
40
+ transaction: z.nullable(UnsignedTransaction$inboundSchema).optional(),
41
+ eip_712: z.nullable(BatchedSafeOperationsResponseOutput$inboundSchema)
42
+ .optional(),
43
+ actions_count: z.number().int(),
44
+ }).transform((v) => {
45
+ return remap$(v, {
46
+ "eip_712": "eip712",
47
+ "actions_count": "actionsCount",
48
+ });
49
+ });
50
+
51
+ export function creditBundleResponseFromJSON(
52
+ jsonString: string,
53
+ ): SafeParseResult<CreditBundleResponse, SDKValidationError> {
54
+ return safeParse(
55
+ jsonString,
56
+ (x) => CreditBundleResponse$inboundSchema.parse(JSON.parse(x)),
57
+ `Failed to parse 'CreditBundleResponse' from JSON`,
58
+ );
59
+ }
@@ -0,0 +1,92 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+
12
+ /**
13
+ * Type of credit event.
14
+ */
15
+ export const EventType = {
16
+ Supply: "supply",
17
+ Withdraw: "withdraw",
18
+ Borrow: "borrow",
19
+ Repay: "repay",
20
+ Liquidation: "liquidation",
21
+ } as const;
22
+ /**
23
+ * Type of credit event.
24
+ */
25
+ export type EventType = ClosedEnum<typeof EventType>;
26
+
27
+ /**
28
+ * A single historical event in a credit position.
29
+ */
30
+ export type CreditEvent = {
31
+ /**
32
+ * Type of credit event.
33
+ */
34
+ eventType: EventType;
35
+ /**
36
+ * Block number when the event occurred
37
+ */
38
+ blockNumber: number;
39
+ /**
40
+ * Timestamp when the event occurred
41
+ */
42
+ blockTimestamp: Date;
43
+ /**
44
+ * Transaction hash of the event
45
+ */
46
+ transactionHash: string;
47
+ /**
48
+ * Amount involved in the event
49
+ */
50
+ amount: string;
51
+ /**
52
+ * Symbol of the token
53
+ */
54
+ symbol: string;
55
+ };
56
+
57
+ /** @internal */
58
+ export const EventType$inboundSchema: z.ZodNativeEnum<typeof EventType> = z
59
+ .nativeEnum(EventType);
60
+
61
+ /** @internal */
62
+ export const CreditEvent$inboundSchema: z.ZodType<
63
+ CreditEvent,
64
+ z.ZodTypeDef,
65
+ unknown
66
+ > = z.object({
67
+ event_type: EventType$inboundSchema,
68
+ block_number: z.number().int(),
69
+ block_timestamp: z.string().datetime({ offset: true }).transform(v =>
70
+ new Date(v)
71
+ ),
72
+ transaction_hash: z.string(),
73
+ amount: z.string(),
74
+ symbol: z.string(),
75
+ }).transform((v) => {
76
+ return remap$(v, {
77
+ "event_type": "eventType",
78
+ "block_number": "blockNumber",
79
+ "block_timestamp": "blockTimestamp",
80
+ "transaction_hash": "transactionHash",
81
+ });
82
+ });
83
+
84
+ export function creditEventFromJSON(
85
+ jsonString: string,
86
+ ): SafeParseResult<CreditEvent, SDKValidationError> {
87
+ return safeParse(
88
+ jsonString,
89
+ (x) => CreditEvent$inboundSchema.parse(JSON.parse(x)),
90
+ `Failed to parse 'CreditEvent' from JSON`,
91
+ );
92
+ }
@@ -0,0 +1,79 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import {
11
+ AccountSummary,
12
+ AccountSummary$inboundSchema,
13
+ } from "./accountsummary.js";
14
+ import {
15
+ BorrowableToken,
16
+ BorrowableToken$inboundSchema,
17
+ } from "./borrowabletoken.js";
18
+ import {
19
+ CollateralPosition,
20
+ CollateralPosition$inboundSchema,
21
+ } from "./collateralposition.js";
22
+ import { DebtPosition, DebtPosition$inboundSchema } from "./debtposition.js";
23
+
24
+ /**
25
+ * Credit account positions response with per-reserve positions and account summary.
26
+ */
27
+ export type CreditPositionsResponse = {
28
+ /**
29
+ * All collateral positions, one per reserve.
30
+ */
31
+ collateralPositions?: Array<CollateralPosition> | undefined;
32
+ /**
33
+ * All debt positions, one per reserve.
34
+ */
35
+ debtPositions?: Array<DebtPosition> | undefined;
36
+ /**
37
+ * Aave account-level summary from getUserAccountData().
38
+ */
39
+ accountSummary: AccountSummary;
40
+ /**
41
+ * All tokens available for borrowing with max amounts based on current collateral.
42
+ */
43
+ borrowableTokens?: Array<BorrowableToken> | undefined;
44
+ /**
45
+ * Net position value in USD (total collateral - total debt). Null if prices unavailable.
46
+ */
47
+ totalUsdValue?: string | null | undefined;
48
+ };
49
+
50
+ /** @internal */
51
+ export const CreditPositionsResponse$inboundSchema: z.ZodType<
52
+ CreditPositionsResponse,
53
+ z.ZodTypeDef,
54
+ unknown
55
+ > = z.object({
56
+ collateral_positions: z.array(CollateralPosition$inboundSchema).optional(),
57
+ debt_positions: z.array(DebtPosition$inboundSchema).optional(),
58
+ account_summary: AccountSummary$inboundSchema,
59
+ borrowable_tokens: z.array(BorrowableToken$inboundSchema).optional(),
60
+ total_usd_value: z.nullable(z.string()).optional(),
61
+ }).transform((v) => {
62
+ return remap$(v, {
63
+ "collateral_positions": "collateralPositions",
64
+ "debt_positions": "debtPositions",
65
+ "account_summary": "accountSummary",
66
+ "borrowable_tokens": "borrowableTokens",
67
+ "total_usd_value": "totalUsdValue",
68
+ });
69
+ });
70
+
71
+ export function creditPositionsResponseFromJSON(
72
+ jsonString: string,
73
+ ): SafeParseResult<CreditPositionsResponse, SDKValidationError> {
74
+ return safeParse(
75
+ jsonString,
76
+ (x) => CreditPositionsResponse$inboundSchema.parse(JSON.parse(x)),
77
+ `Failed to parse 'CreditPositionsResponse' from JSON`,
78
+ );
79
+ }