@superfluid-finance/sdk-core 0.1.1-dev.8caff13.0 → 0.1.1-dev.b8d3bbf.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 (440) hide show
  1. package/README.md +37 -11
  2. package/dist/index.umd.js +45852 -0
  3. package/dist/main/BatchCall.d.ts +1 -0
  4. package/dist/main/BatchCall.d.ts.map +1 -0
  5. package/dist/main/BatchCall.js +128 -0
  6. package/dist/main/BatchCall.js.map +1 -0
  7. package/dist/main/ConstantFlowAgreementV1.d.ts +7 -3
  8. package/dist/main/ConstantFlowAgreementV1.d.ts.map +1 -0
  9. package/dist/main/ConstantFlowAgreementV1.js +178 -0
  10. package/dist/main/ConstantFlowAgreementV1.js.map +1 -0
  11. package/dist/main/Framework.d.ts +7 -2
  12. package/dist/main/Framework.d.ts.map +1 -0
  13. package/dist/main/Framework.js +177 -0
  14. package/dist/main/Framework.js.map +1 -0
  15. package/dist/main/Host.d.ts +6 -1
  16. package/dist/main/Host.d.ts.map +1 -0
  17. package/dist/main/Host.js +31 -0
  18. package/dist/main/Host.js.map +1 -0
  19. package/dist/main/InstantDistributionAgreementV1.d.ts +18 -9
  20. package/dist/main/InstantDistributionAgreementV1.d.ts.map +1 -0
  21. package/dist/main/InstantDistributionAgreementV1.js +249 -0
  22. package/dist/main/InstantDistributionAgreementV1.js.map +1 -0
  23. package/dist/main/Operation.d.ts +1 -0
  24. package/dist/main/Operation.d.ts.map +1 -0
  25. package/dist/main/Operation.js +86 -0
  26. package/dist/main/Operation.js.map +1 -0
  27. package/dist/main/Query.d.ts +1 -0
  28. package/dist/main/Query.d.ts.map +1 -0
  29. package/dist/main/Query.js +310 -0
  30. package/dist/main/Query.js.map +1 -0
  31. package/dist/main/SFError.d.ts +1 -0
  32. package/dist/main/SFError.d.ts.map +1 -0
  33. package/dist/main/SFError.js +36 -0
  34. package/dist/main/SFError.js.map +1 -0
  35. package/dist/main/SuperToken.d.ts +34 -14
  36. package/dist/main/SuperToken.d.ts.map +1 -0
  37. package/dist/main/SuperToken.js +396 -0
  38. package/dist/main/SuperToken.js.map +1 -0
  39. package/dist/main/Token.d.ts +7 -3
  40. package/dist/main/Token.d.ts.map +1 -0
  41. package/dist/main/Token.js +166 -0
  42. package/dist/main/Token.js.map +1 -0
  43. package/dist/main/abi/ERC20WithTokenInfo.json +224 -0
  44. package/dist/main/abi/IConstantFlowAgreementV1.json +406 -0
  45. package/dist/main/abi/IInstantDistributionAgreementV1.json +947 -0
  46. package/dist/main/abi/IResolver.json +58 -0
  47. package/dist/main/abi/SuperToken.json +1549 -0
  48. package/dist/main/abi/Superfluid.json +1159 -0
  49. package/dist/main/abi/SuperfluidLoader.json +54 -0
  50. package/dist/main/constants.d.ts +2 -1
  51. package/dist/main/constants.d.ts.map +1 -0
  52. package/dist/main/constants.js +134 -0
  53. package/dist/main/constants.js.map +1 -0
  54. package/dist/main/events.d.ts +1 -0
  55. package/dist/main/events.d.ts.map +1 -0
  56. package/dist/main/events.js +3 -0
  57. package/dist/main/events.js.map +1 -0
  58. package/dist/main/frameworkHelpers.d.ts +1 -0
  59. package/dist/main/frameworkHelpers.d.ts.map +1 -0
  60. package/dist/main/frameworkHelpers.js +89 -0
  61. package/dist/main/frameworkHelpers.js.map +1 -0
  62. package/dist/main/index.d.ts +6 -0
  63. package/dist/main/index.d.ts.map +1 -0
  64. package/dist/main/index.js +38 -7597
  65. package/dist/main/index.js.map +1 -0
  66. package/dist/main/interfaces.d.ts +100 -10
  67. package/dist/main/interfaces.d.ts.map +1 -0
  68. package/dist/main/interfaces.js +3 -0
  69. package/dist/main/interfaces.js.map +1 -0
  70. package/dist/main/mapGetAllEventsQueryEvents.d.ts +1 -0
  71. package/dist/main/mapGetAllEventsQueryEvents.d.ts.map +1 -0
  72. package/dist/main/mapGetAllEventsQueryEvents.js +432 -0
  73. package/dist/main/mapGetAllEventsQueryEvents.js.map +1 -0
  74. package/dist/main/ordering.d.ts +1 -0
  75. package/dist/main/ordering.d.ts.map +1 -0
  76. package/dist/main/ordering.js +3 -0
  77. package/dist/main/ordering.js.map +1 -0
  78. package/dist/main/pagination.d.ts +1 -0
  79. package/dist/main/pagination.d.ts.map +1 -0
  80. package/dist/main/pagination.js +60 -0
  81. package/dist/main/pagination.js.map +1 -0
  82. package/dist/main/subgraph/SubgraphClient.d.ts +1 -0
  83. package/dist/main/subgraph/SubgraphClient.d.ts.map +1 -0
  84. package/dist/main/subgraph/SubgraphClient.js +51 -0
  85. package/dist/main/subgraph/SubgraphClient.js.map +1 -0
  86. package/dist/main/subgraph/queries/getAccountTokenSnapshots.generated.d.ts +1 -0
  87. package/dist/main/subgraph/queries/getAccountTokenSnapshots.generated.d.ts.map +1 -0
  88. package/dist/main/subgraph/queries/getAccountTokenSnapshots.generated.js +5 -0
  89. package/dist/main/subgraph/queries/getAccountTokenSnapshots.generated.js.map +1 -0
  90. package/dist/main/subgraph/queries/getAllEvents.generated.d.ts +1 -0
  91. package/dist/main/subgraph/queries/getAllEvents.generated.d.ts.map +1 -0
  92. package/dist/main/subgraph/queries/getAllEvents.generated.js +6 -0
  93. package/dist/main/subgraph/queries/getAllEvents.generated.js.map +1 -0
  94. package/dist/main/subgraph/queries/getIndexSubscriptions.generated.d.ts +1 -0
  95. package/dist/main/subgraph/queries/getIndexSubscriptions.generated.d.ts.map +1 -0
  96. package/dist/main/subgraph/queries/getIndexSubscriptions.generated.js +5 -0
  97. package/dist/main/subgraph/queries/getIndexSubscriptions.generated.js.map +1 -0
  98. package/dist/main/subgraph/queries/getIndexes.generated.d.ts +1 -0
  99. package/dist/main/subgraph/queries/getIndexes.generated.d.ts.map +1 -0
  100. package/dist/main/subgraph/queries/getIndexes.generated.js +5 -0
  101. package/dist/main/subgraph/queries/getIndexes.generated.js.map +1 -0
  102. package/dist/main/subgraph/queries/getStreams.generated.d.ts +1 -0
  103. package/dist/main/subgraph/queries/getStreams.generated.d.ts.map +1 -0
  104. package/dist/main/subgraph/queries/getStreams.generated.js +5 -0
  105. package/dist/main/subgraph/queries/getStreams.generated.js.map +1 -0
  106. package/dist/main/subgraph/queries/getTokens.generated.d.ts +1 -0
  107. package/dist/main/subgraph/queries/getTokens.generated.d.ts.map +1 -0
  108. package/dist/main/subgraph/queries/getTokens.generated.js +5 -0
  109. package/dist/main/subgraph/queries/getTokens.generated.js.map +1 -0
  110. package/dist/main/subgraph/schema.generated.d.ts +1 -0
  111. package/dist/main/subgraph/schema.generated.d.ts.map +1 -0
  112. package/dist/main/subgraph/schema.generated.js +3 -0
  113. package/dist/main/subgraph/schema.generated.js.map +1 -0
  114. package/dist/main/typechain/ERC20WithTokenInfo.d.ts +1 -0
  115. package/dist/main/typechain/ERC20WithTokenInfo.d.ts.map +1 -0
  116. package/dist/main/typechain/ERC20WithTokenInfo.js +3 -0
  117. package/dist/main/typechain/ERC20WithTokenInfo.js.map +1 -0
  118. package/dist/main/typechain/IConstantFlowAgreementV1.d.ts +1 -0
  119. package/dist/main/typechain/IConstantFlowAgreementV1.d.ts.map +1 -0
  120. package/dist/main/typechain/IConstantFlowAgreementV1.js +3 -0
  121. package/dist/main/typechain/IConstantFlowAgreementV1.js.map +1 -0
  122. package/dist/main/typechain/IInstantDistributionAgreementV1.d.ts +1 -0
  123. package/dist/main/typechain/IInstantDistributionAgreementV1.d.ts.map +1 -0
  124. package/dist/main/typechain/IInstantDistributionAgreementV1.js +3 -0
  125. package/dist/main/typechain/IInstantDistributionAgreementV1.js.map +1 -0
  126. package/dist/main/typechain/IResolver.d.ts +7 -6
  127. package/dist/main/typechain/IResolver.d.ts.map +1 -0
  128. package/dist/main/typechain/IResolver.js +3 -0
  129. package/dist/main/typechain/IResolver.js.map +1 -0
  130. package/dist/main/typechain/SuperToken.d.ts +1 -0
  131. package/dist/main/typechain/SuperToken.d.ts.map +1 -0
  132. package/dist/main/typechain/SuperToken.js +3 -0
  133. package/dist/main/typechain/SuperToken.js.map +1 -0
  134. package/dist/main/typechain/Superfluid.d.ts +1 -0
  135. package/dist/main/typechain/Superfluid.d.ts.map +1 -0
  136. package/dist/main/typechain/Superfluid.js +3 -0
  137. package/dist/main/typechain/Superfluid.js.map +1 -0
  138. package/dist/main/typechain/SuperfluidLoader.d.ts +1 -0
  139. package/dist/main/typechain/SuperfluidLoader.d.ts.map +1 -0
  140. package/dist/main/typechain/SuperfluidLoader.js +3 -0
  141. package/dist/main/typechain/SuperfluidLoader.js.map +1 -0
  142. package/dist/main/typechain/TestToken.d.ts +1 -0
  143. package/dist/main/typechain/TestToken.d.ts.map +1 -0
  144. package/dist/main/typechain/TestToken.js +3 -0
  145. package/dist/main/typechain/TestToken.js.map +1 -0
  146. package/dist/main/typechain/common.d.ts +1 -0
  147. package/dist/main/typechain/common.d.ts.map +1 -0
  148. package/dist/main/typechain/common.js +3 -0
  149. package/dist/main/typechain/common.js.map +1 -0
  150. package/dist/main/typechain/factories/ERC20WithTokenInfo__factory.d.ts +1 -0
  151. package/dist/main/typechain/factories/ERC20WithTokenInfo__factory.d.ts.map +1 -0
  152. package/dist/main/typechain/factories/ERC20WithTokenInfo__factory.js +242 -0
  153. package/dist/main/typechain/factories/ERC20WithTokenInfo__factory.js.map +1 -0
  154. package/dist/main/typechain/factories/IConstantFlowAgreementV1__factory.d.ts +1 -0
  155. package/dist/main/typechain/factories/IConstantFlowAgreementV1__factory.d.ts.map +1 -0
  156. package/dist/main/typechain/factories/IConstantFlowAgreementV1__factory.js +424 -0
  157. package/dist/main/typechain/factories/IConstantFlowAgreementV1__factory.js.map +1 -0
  158. package/dist/main/typechain/factories/IInstantDistributionAgreementV1__factory.d.ts +1 -0
  159. package/dist/main/typechain/factories/IInstantDistributionAgreementV1__factory.d.ts.map +1 -0
  160. package/dist/main/typechain/factories/IInstantDistributionAgreementV1__factory.js +965 -0
  161. package/dist/main/typechain/factories/IInstantDistributionAgreementV1__factory.js.map +1 -0
  162. package/dist/main/typechain/factories/IResolver__factory.d.ts +1 -0
  163. package/dist/main/typechain/factories/IResolver__factory.d.ts.map +1 -0
  164. package/dist/main/typechain/factories/IResolver__factory.js +76 -0
  165. package/dist/main/typechain/factories/IResolver__factory.js.map +1 -0
  166. package/dist/main/typechain/factories/SuperToken__factory.d.ts +1 -0
  167. package/dist/main/typechain/factories/SuperToken__factory.d.ts.map +1 -0
  168. package/dist/main/typechain/factories/SuperToken__factory.js +1567 -0
  169. package/dist/main/typechain/factories/SuperToken__factory.js.map +1 -0
  170. package/dist/main/typechain/factories/SuperfluidLoader__factory.d.ts +1 -0
  171. package/dist/main/typechain/factories/SuperfluidLoader__factory.d.ts.map +1 -0
  172. package/dist/main/typechain/factories/SuperfluidLoader__factory.js +72 -0
  173. package/dist/main/typechain/factories/SuperfluidLoader__factory.js.map +1 -0
  174. package/dist/main/typechain/factories/Superfluid__factory.d.ts +1 -0
  175. package/dist/main/typechain/factories/Superfluid__factory.d.ts.map +1 -0
  176. package/dist/main/typechain/factories/Superfluid__factory.js +1177 -0
  177. package/dist/main/typechain/factories/Superfluid__factory.js.map +1 -0
  178. package/dist/main/typechain/factories/TestToken__factory.d.ts +1 -0
  179. package/dist/main/typechain/factories/TestToken__factory.d.ts.map +1 -0
  180. package/dist/main/typechain/factories/TestToken__factory.js +348 -0
  181. package/dist/main/typechain/factories/TestToken__factory.js.map +1 -0
  182. package/dist/main/typechain/index.d.ts +1 -0
  183. package/dist/main/typechain/index.d.ts.map +1 -0
  184. package/dist/main/typechain/index.js +20 -0
  185. package/dist/main/typechain/index.js.map +1 -0
  186. package/dist/main/types.d.ts +1 -0
  187. package/dist/main/types.d.ts.map +1 -0
  188. package/dist/main/types.js +3 -0
  189. package/dist/main/types.js.map +1 -0
  190. package/dist/main/utils.d.ts +6 -0
  191. package/dist/main/utils.d.ts.map +1 -0
  192. package/dist/main/utils.js +178 -0
  193. package/dist/main/utils.js.map +1 -0
  194. package/dist/main/validation.d.ts +1 -0
  195. package/dist/main/validation.d.ts.map +1 -0
  196. package/dist/main/validation.js +98 -0
  197. package/dist/main/validation.js.map +1 -0
  198. package/dist/module/BatchCall.d.ts +1 -0
  199. package/dist/module/BatchCall.d.ts.map +1 -0
  200. package/dist/module/BatchCall.js +122 -0
  201. package/dist/module/BatchCall.js.map +1 -0
  202. package/dist/module/ConstantFlowAgreementV1.d.ts +7 -3
  203. package/dist/module/ConstantFlowAgreementV1.d.ts.map +1 -0
  204. package/dist/module/ConstantFlowAgreementV1.js +172 -0
  205. package/dist/module/ConstantFlowAgreementV1.js.map +1 -0
  206. package/dist/module/Framework.d.ts +7 -2
  207. package/dist/module/Framework.d.ts.map +1 -0
  208. package/dist/module/Framework.js +171 -0
  209. package/dist/module/Framework.js.map +1 -0
  210. package/dist/module/Host.d.ts +6 -1
  211. package/dist/module/Host.d.ts.map +1 -0
  212. package/dist/module/Host.js +25 -0
  213. package/dist/module/Host.js.map +1 -0
  214. package/dist/module/InstantDistributionAgreementV1.d.ts +18 -9
  215. package/dist/module/InstantDistributionAgreementV1.d.ts.map +1 -0
  216. package/dist/module/InstantDistributionAgreementV1.js +243 -0
  217. package/dist/module/InstantDistributionAgreementV1.js.map +1 -0
  218. package/dist/module/Operation.d.ts +1 -0
  219. package/dist/module/Operation.d.ts.map +1 -0
  220. package/dist/module/Operation.js +80 -0
  221. package/dist/module/Operation.js.map +1 -0
  222. package/dist/module/Query.d.ts +1 -0
  223. package/dist/module/Query.d.ts.map +1 -0
  224. package/dist/module/Query.js +304 -0
  225. package/dist/module/Query.js.map +1 -0
  226. package/dist/module/SFError.d.ts +1 -0
  227. package/dist/module/SFError.d.ts.map +1 -0
  228. package/dist/module/SFError.js +33 -0
  229. package/dist/module/SFError.js.map +1 -0
  230. package/dist/module/SuperToken.d.ts +34 -14
  231. package/dist/module/SuperToken.d.ts.map +1 -0
  232. package/dist/module/SuperToken.js +390 -0
  233. package/dist/module/SuperToken.js.map +1 -0
  234. package/dist/module/Token.d.ts +7 -3
  235. package/dist/module/Token.d.ts.map +1 -0
  236. package/dist/module/Token.js +160 -0
  237. package/dist/module/Token.js.map +1 -0
  238. package/dist/module/abi/ERC20WithTokenInfo.json +224 -0
  239. package/dist/module/abi/IConstantFlowAgreementV1.json +406 -0
  240. package/dist/module/abi/IInstantDistributionAgreementV1.json +947 -0
  241. package/dist/module/abi/IResolver.json +58 -0
  242. package/dist/module/abi/SuperToken.json +1549 -0
  243. package/dist/module/abi/Superfluid.json +1159 -0
  244. package/dist/module/abi/SuperfluidLoader.json +54 -0
  245. package/dist/module/constants.d.ts +2 -1
  246. package/dist/module/constants.d.ts.map +1 -0
  247. package/dist/module/constants.js +131 -0
  248. package/dist/module/constants.js.map +1 -0
  249. package/dist/module/events.d.ts +1 -0
  250. package/dist/module/events.d.ts.map +1 -0
  251. package/dist/module/events.js +2 -0
  252. package/dist/module/events.js.map +1 -0
  253. package/dist/module/frameworkHelpers.d.ts +1 -0
  254. package/dist/module/frameworkHelpers.d.ts.map +1 -0
  255. package/dist/module/frameworkHelpers.js +80 -0
  256. package/dist/module/frameworkHelpers.js.map +1 -0
  257. package/dist/module/index.d.ts +6 -0
  258. package/dist/module/index.d.ts.map +1 -0
  259. package/dist/module/index.js +25 -7561
  260. package/dist/module/index.js.map +1 -0
  261. package/dist/module/interfaces.d.ts +100 -10
  262. package/dist/module/interfaces.d.ts.map +1 -0
  263. package/dist/module/interfaces.js +2 -0
  264. package/dist/module/interfaces.js.map +1 -0
  265. package/dist/module/mapGetAllEventsQueryEvents.d.ts +1 -0
  266. package/dist/module/mapGetAllEventsQueryEvents.d.ts.map +1 -0
  267. package/dist/module/mapGetAllEventsQueryEvents.js +428 -0
  268. package/dist/module/mapGetAllEventsQueryEvents.js.map +1 -0
  269. package/dist/module/ordering.d.ts +1 -0
  270. package/dist/module/ordering.d.ts.map +1 -0
  271. package/dist/module/ordering.js +2 -0
  272. package/dist/module/ordering.js.map +1 -0
  273. package/dist/module/pagination.d.ts +1 -0
  274. package/dist/module/pagination.d.ts.map +1 -0
  275. package/dist/module/pagination.js +51 -0
  276. package/dist/module/pagination.js.map +1 -0
  277. package/dist/module/subgraph/SubgraphClient.d.ts +1 -0
  278. package/dist/module/subgraph/SubgraphClient.d.ts.map +1 -0
  279. package/dist/module/subgraph/SubgraphClient.js +44 -0
  280. package/dist/module/subgraph/SubgraphClient.js.map +1 -0
  281. package/dist/module/subgraph/queries/getAccountTokenSnapshots.generated.d.ts +1 -0
  282. package/dist/module/subgraph/queries/getAccountTokenSnapshots.generated.d.ts.map +1 -0
  283. package/dist/module/subgraph/queries/getAccountTokenSnapshots.generated.js +2 -0
  284. package/dist/module/subgraph/queries/getAccountTokenSnapshots.generated.js.map +1 -0
  285. package/dist/module/subgraph/queries/getAllEvents.generated.d.ts +1 -0
  286. package/dist/module/subgraph/queries/getAllEvents.generated.d.ts.map +1 -0
  287. package/dist/module/subgraph/queries/getAllEvents.generated.js +3 -0
  288. package/dist/module/subgraph/queries/getAllEvents.generated.js.map +1 -0
  289. package/dist/module/subgraph/queries/getIndexSubscriptions.generated.d.ts +1 -0
  290. package/dist/module/subgraph/queries/getIndexSubscriptions.generated.d.ts.map +1 -0
  291. package/dist/module/subgraph/queries/getIndexSubscriptions.generated.js +2 -0
  292. package/dist/module/subgraph/queries/getIndexSubscriptions.generated.js.map +1 -0
  293. package/dist/module/subgraph/queries/getIndexes.generated.d.ts +1 -0
  294. package/dist/module/subgraph/queries/getIndexes.generated.d.ts.map +1 -0
  295. package/dist/module/subgraph/queries/getIndexes.generated.js +2 -0
  296. package/dist/module/subgraph/queries/getIndexes.generated.js.map +1 -0
  297. package/dist/module/subgraph/queries/getStreams.generated.d.ts +1 -0
  298. package/dist/module/subgraph/queries/getStreams.generated.d.ts.map +1 -0
  299. package/dist/module/subgraph/queries/getStreams.generated.js +2 -0
  300. package/dist/module/subgraph/queries/getStreams.generated.js.map +1 -0
  301. package/dist/module/subgraph/queries/getTokens.generated.d.ts +1 -0
  302. package/dist/module/subgraph/queries/getTokens.generated.d.ts.map +1 -0
  303. package/dist/module/subgraph/queries/getTokens.generated.js +2 -0
  304. package/dist/module/subgraph/queries/getTokens.generated.js.map +1 -0
  305. package/dist/module/subgraph/schema.generated.d.ts +1 -0
  306. package/dist/module/subgraph/schema.generated.d.ts.map +1 -0
  307. package/dist/module/subgraph/schema.generated.js +2 -0
  308. package/dist/module/subgraph/schema.generated.js.map +1 -0
  309. package/dist/module/typechain/ERC20WithTokenInfo.d.ts +1 -0
  310. package/dist/module/typechain/ERC20WithTokenInfo.d.ts.map +1 -0
  311. package/dist/module/typechain/ERC20WithTokenInfo.js +2 -0
  312. package/dist/module/typechain/ERC20WithTokenInfo.js.map +1 -0
  313. package/dist/module/typechain/IConstantFlowAgreementV1.d.ts +1 -0
  314. package/dist/module/typechain/IConstantFlowAgreementV1.d.ts.map +1 -0
  315. package/dist/module/typechain/IConstantFlowAgreementV1.js +2 -0
  316. package/dist/module/typechain/IConstantFlowAgreementV1.js.map +1 -0
  317. package/dist/module/typechain/IInstantDistributionAgreementV1.d.ts +1 -0
  318. package/dist/module/typechain/IInstantDistributionAgreementV1.d.ts.map +1 -0
  319. package/dist/module/typechain/IInstantDistributionAgreementV1.js +2 -0
  320. package/dist/module/typechain/IInstantDistributionAgreementV1.js.map +1 -0
  321. package/dist/module/typechain/IResolver.d.ts +7 -6
  322. package/dist/module/typechain/IResolver.d.ts.map +1 -0
  323. package/dist/module/typechain/IResolver.js +2 -0
  324. package/dist/module/typechain/IResolver.js.map +1 -0
  325. package/dist/module/typechain/SuperToken.d.ts +1 -0
  326. package/dist/module/typechain/SuperToken.d.ts.map +1 -0
  327. package/dist/module/typechain/SuperToken.js +2 -0
  328. package/dist/module/typechain/SuperToken.js.map +1 -0
  329. package/dist/module/typechain/Superfluid.d.ts +1 -0
  330. package/dist/module/typechain/Superfluid.d.ts.map +1 -0
  331. package/dist/module/typechain/Superfluid.js +2 -0
  332. package/dist/module/typechain/Superfluid.js.map +1 -0
  333. package/dist/module/typechain/SuperfluidLoader.d.ts +1 -0
  334. package/dist/module/typechain/SuperfluidLoader.d.ts.map +1 -0
  335. package/dist/module/typechain/SuperfluidLoader.js +2 -0
  336. package/dist/module/typechain/SuperfluidLoader.js.map +1 -0
  337. package/dist/module/typechain/TestToken.d.ts +1 -0
  338. package/dist/module/typechain/TestToken.d.ts.map +1 -0
  339. package/dist/module/typechain/TestToken.js +2 -0
  340. package/dist/module/typechain/TestToken.js.map +1 -0
  341. package/dist/module/typechain/common.d.ts +1 -0
  342. package/dist/module/typechain/common.d.ts.map +1 -0
  343. package/dist/module/typechain/common.js +2 -0
  344. package/dist/module/typechain/common.js.map +1 -0
  345. package/dist/module/typechain/factories/ERC20WithTokenInfo__factory.d.ts +1 -0
  346. package/dist/module/typechain/factories/ERC20WithTokenInfo__factory.d.ts.map +1 -0
  347. package/dist/module/typechain/factories/ERC20WithTokenInfo__factory.js +238 -0
  348. package/dist/module/typechain/factories/ERC20WithTokenInfo__factory.js.map +1 -0
  349. package/dist/module/typechain/factories/IConstantFlowAgreementV1__factory.d.ts +1 -0
  350. package/dist/module/typechain/factories/IConstantFlowAgreementV1__factory.d.ts.map +1 -0
  351. package/dist/module/typechain/factories/IConstantFlowAgreementV1__factory.js +420 -0
  352. package/dist/module/typechain/factories/IConstantFlowAgreementV1__factory.js.map +1 -0
  353. package/dist/module/typechain/factories/IInstantDistributionAgreementV1__factory.d.ts +1 -0
  354. package/dist/module/typechain/factories/IInstantDistributionAgreementV1__factory.d.ts.map +1 -0
  355. package/dist/module/typechain/factories/IInstantDistributionAgreementV1__factory.js +961 -0
  356. package/dist/module/typechain/factories/IInstantDistributionAgreementV1__factory.js.map +1 -0
  357. package/dist/module/typechain/factories/IResolver__factory.d.ts +1 -0
  358. package/dist/module/typechain/factories/IResolver__factory.d.ts.map +1 -0
  359. package/dist/module/typechain/factories/IResolver__factory.js +72 -0
  360. package/dist/module/typechain/factories/IResolver__factory.js.map +1 -0
  361. package/dist/module/typechain/factories/SuperToken__factory.d.ts +1 -0
  362. package/dist/module/typechain/factories/SuperToken__factory.d.ts.map +1 -0
  363. package/dist/module/typechain/factories/SuperToken__factory.js +1563 -0
  364. package/dist/module/typechain/factories/SuperToken__factory.js.map +1 -0
  365. package/dist/module/typechain/factories/SuperfluidLoader__factory.d.ts +1 -0
  366. package/dist/module/typechain/factories/SuperfluidLoader__factory.d.ts.map +1 -0
  367. package/dist/module/typechain/factories/SuperfluidLoader__factory.js +68 -0
  368. package/dist/module/typechain/factories/SuperfluidLoader__factory.js.map +1 -0
  369. package/dist/module/typechain/factories/Superfluid__factory.d.ts +1 -0
  370. package/dist/module/typechain/factories/Superfluid__factory.d.ts.map +1 -0
  371. package/dist/module/typechain/factories/Superfluid__factory.js +1173 -0
  372. package/dist/module/typechain/factories/Superfluid__factory.js.map +1 -0
  373. package/dist/module/typechain/factories/TestToken__factory.d.ts +1 -0
  374. package/dist/module/typechain/factories/TestToken__factory.d.ts.map +1 -0
  375. package/dist/module/typechain/factories/TestToken__factory.js +344 -0
  376. package/dist/module/typechain/factories/TestToken__factory.js.map +1 -0
  377. package/dist/module/typechain/index.d.ts +1 -0
  378. package/dist/module/typechain/index.d.ts.map +1 -0
  379. package/dist/{umd/typechain/index.d.ts → module/typechain/index.js} +1 -8
  380. package/dist/module/typechain/index.js.map +1 -0
  381. package/dist/module/types.d.ts +1 -0
  382. package/dist/module/types.d.ts.map +1 -0
  383. package/dist/module/types.js +2 -0
  384. package/dist/module/types.js.map +1 -0
  385. package/dist/module/utils.d.ts +6 -0
  386. package/dist/module/utils.d.ts.map +1 -0
  387. package/dist/module/utils.js +153 -0
  388. package/dist/module/utils.js.map +1 -0
  389. package/dist/module/validation.d.ts +1 -0
  390. package/dist/module/validation.d.ts.map +1 -0
  391. package/dist/module/validation.js +92 -0
  392. package/dist/module/validation.js.map +1 -0
  393. package/package.json +29 -15
  394. package/dist/umd/BatchCall.d.ts +0 -53
  395. package/dist/umd/ConstantFlowAgreementV1.d.ts +0 -74
  396. package/dist/umd/Framework.d.ts +0 -75
  397. package/dist/umd/Host.d.ts +0 -18
  398. package/dist/umd/InstantDistributionAgreementV1.d.ts +0 -107
  399. package/dist/umd/Operation.d.ts +0 -38
  400. package/dist/umd/Query.d.ts +0 -31
  401. package/dist/umd/SFError.d.ts +0 -13
  402. package/dist/umd/SuperToken.d.ts +0 -191
  403. package/dist/umd/Token.d.ts +0 -76
  404. package/dist/umd/constants.d.ts +0 -17
  405. package/dist/umd/events.d.ts +0 -255
  406. package/dist/umd/frameworkHelpers.d.ts +0 -20
  407. package/dist/umd/index.d.ts +0 -19
  408. package/dist/umd/index.js +0 -7599
  409. package/dist/umd/interfaces.d.ts +0 -304
  410. package/dist/umd/mapGetAllEventsQueryEvents.d.ts +0 -3
  411. package/dist/umd/ordering.d.ts +0 -13
  412. package/dist/umd/pagination.d.ts +0 -65
  413. package/dist/umd/subgraph/SubgraphClient.d.ts +0 -16
  414. package/dist/umd/subgraph/queries/getAccountTokenSnapshots.generated.d.ts +0 -45
  415. package/dist/umd/subgraph/queries/getAllEvents.generated.d.ts +0 -651
  416. package/dist/umd/subgraph/queries/getIndexSubscriptions.generated.d.ts +0 -46
  417. package/dist/umd/subgraph/queries/getIndexes.generated.d.ts +0 -44
  418. package/dist/umd/subgraph/queries/getStreams.generated.d.ts +0 -58
  419. package/dist/umd/subgraph/queries/getTokens.generated.d.ts +0 -27
  420. package/dist/umd/subgraph/schema.generated.d.ts +0 -6478
  421. package/dist/umd/typechain/ERC20WithTokenInfo.d.ts +0 -159
  422. package/dist/umd/typechain/IConstantFlowAgreementV1.d.ts +0 -305
  423. package/dist/umd/typechain/IInstantDistributionAgreementV1.d.ts +0 -585
  424. package/dist/umd/typechain/IResolver.d.ts +0 -71
  425. package/dist/umd/typechain/SuperToken.d.ts +0 -1011
  426. package/dist/umd/typechain/Superfluid.d.ts +0 -780
  427. package/dist/umd/typechain/SuperfluidLoader.d.ts +0 -55
  428. package/dist/umd/typechain/TestToken.d.ts +0 -215
  429. package/dist/umd/typechain/common.d.ts +0 -21
  430. package/dist/umd/typechain/factories/ERC20WithTokenInfo__factory.d.ts +0 -35
  431. package/dist/umd/typechain/factories/IConstantFlowAgreementV1__factory.d.ts +0 -35
  432. package/dist/umd/typechain/factories/IInstantDistributionAgreementV1__factory.d.ts +0 -35
  433. package/dist/umd/typechain/factories/IResolver__factory.d.ts +0 -35
  434. package/dist/umd/typechain/factories/SuperToken__factory.d.ts +0 -46
  435. package/dist/umd/typechain/factories/SuperfluidLoader__factory.d.ts +0 -37
  436. package/dist/umd/typechain/factories/Superfluid__factory.d.ts +0 -82
  437. package/dist/umd/typechain/factories/TestToken__factory.d.ts +0 -46
  438. package/dist/umd/types.d.ts +0 -2
  439. package/dist/umd/utils.d.ts +0 -106
  440. package/dist/umd/validation.d.ts +0 -8
@@ -0,0 +1,171 @@
1
+ var _a;
2
+ import { ethers } from "ethers";
3
+ import BatchCall from "./BatchCall";
4
+ import ConstantFlowAgreementV1 from "./ConstantFlowAgreementV1";
5
+ import Host from "./Host";
6
+ import InstantDistributionAgreementV1 from "./InstantDistributionAgreementV1";
7
+ import Query from "./Query";
8
+ import SFError from "./SFError";
9
+ import SuperToken from "./SuperToken";
10
+ import IResolverABI from "./abi/IResolver.json";
11
+ import SuperfluidLoaderABI from "./abi/SuperfluidLoader.json";
12
+ import { chainIdToDataMap, networkNameToChainIdMap } from "./constants";
13
+ import { getNetworkName, getSubgraphQueriesEndpoint, validateFrameworkConstructorOptions, } from "./frameworkHelpers";
14
+ import { isEthersProvider, isInjectedWeb3 } from "./utils";
15
+ /**
16
+ * @dev Superfluid Framework Class
17
+ * @description The entrypoint for the SDK-core, `create` an instance of this for full functionality.
18
+ */
19
+ export default class Framework {
20
+ constructor(options, settings) {
21
+ /**
22
+ * @dev Create a signer which can be used to sign transactions.
23
+ * @param options.web3Provider a Web3Provider object (e.g. client side - metamask, web3modal)
24
+ * @param options.provider an ethers Provider object (e.g. via Hardhat ethers)
25
+ * @param options.privateKey a test account private key
26
+ * @param options.signer a signer object (e.g. ethers.Wallet instance)
27
+ * @returns `ethers.Signer` object
28
+ */
29
+ this.createSigner = (options) => {
30
+ if (!options.privateKey &&
31
+ !options.provider &&
32
+ !options.signer &&
33
+ !options.web3Provider) {
34
+ throw new SFError({
35
+ type: "CREATE_SIGNER",
36
+ customMessage: "You must pass in a private key, provider or signer.",
37
+ });
38
+ }
39
+ /* istanbul ignore else */
40
+ if (options.privateKey) {
41
+ if (!options.provider) {
42
+ throw new SFError({
43
+ type: "CREATE_SIGNER",
44
+ customMessage: "You must pass in a provider with your private key.",
45
+ });
46
+ }
47
+ return new ethers.Wallet(options.privateKey, options.provider);
48
+ }
49
+ else if (options.signer) {
50
+ return options.signer;
51
+ }
52
+ // NOTE: tested by sdk-redux already
53
+ else if (options.web3Provider) {
54
+ return options.web3Provider.getSigner();
55
+ }
56
+ /* istanbul ignore next */
57
+ throw new SFError({
58
+ type: "CREATE_SIGNER",
59
+ customMessage: "Something went wrong, this should never occur.",
60
+ });
61
+ };
62
+ /**
63
+ * @dev Create a `BatchCall` class from the `Framework`.
64
+ * @param operations the list of operations to execute
65
+ * @returns `BatchCall` class
66
+ */
67
+ this.batchCall = (operations) => {
68
+ return new BatchCall({ operations, config: this.settings.config });
69
+ };
70
+ /**
71
+ * @dev Load a `SuperToken` class from the `Framework`.
72
+ * @param address the `SuperToken` address
73
+ * @returns `SuperToken` class
74
+ */
75
+ this.loadSuperToken = async (address) => {
76
+ return await SuperToken.create({ ...this.settings, address });
77
+ };
78
+ this.userInputOptions = options;
79
+ this.settings = settings;
80
+ this.cfaV1 = new ConstantFlowAgreementV1({
81
+ config: this.settings.config,
82
+ });
83
+ this.host = new Host(this.settings.config.hostAddress);
84
+ this.idaV1 = new InstantDistributionAgreementV1({
85
+ config: this.settings.config,
86
+ });
87
+ this.query = new Query(this.settings);
88
+ }
89
+ }
90
+ _a = Framework;
91
+ /**
92
+ * @dev Creates the Framework object based on user provided `options`.
93
+ * @param options.chainId the chainId of your desired network (e.g. 137 = matic)
94
+ * @param options.customSubgraphQueriesEndpoint your custom subgraph endpoint
95
+ * @param options.dataMode the data mode you'd like the framework to use (SUBGRAPH_ONLY, SUBGRAPH_WEB3, WEB3_ONLY)
96
+ * @param options.networkName the desired network (e.g. "matic", "rinkeby", etc.)
97
+ * @param options.resolverAddress a custom resolver address (advanced use for testing)
98
+ * @param options.protocolReleaseVersion a custom release version (advanced use for testing)
99
+ * @param options.provider a provider object (injected web3, injected ethers, ethers provider) necessary for initializing the framework
100
+ * @returns `Framework` class
101
+ */
102
+ Framework.create = async (options) => {
103
+ validateFrameworkConstructorOptions({
104
+ ...options,
105
+ dataMode: options.dataMode || "SUBGRAPH_ONLY",
106
+ protocolReleaseVersion: options.protocolReleaseVersion || "v1",
107
+ });
108
+ const networkName = getNetworkName(options);
109
+ const chainId = options.chainId || networkNameToChainIdMap.get(networkName);
110
+ const releaseVersion = options.protocolReleaseVersion || "v1";
111
+ // NOTE: endpoint can be empty in WEB3_ONLY mode
112
+ const customSubgraphQueriesEndpoint = options.dataMode === "WEB3_ONLY"
113
+ ? ""
114
+ : options.customSubgraphQueriesEndpoint ||
115
+ getSubgraphQueriesEndpoint(options);
116
+ const provider = isEthersProvider(options.provider)
117
+ ? options.provider
118
+ : isInjectedWeb3(options.provider)
119
+ ? // must explicitly cast web3 provider type because
120
+ // ethers.providers.Web3Provider doesn't like
121
+ // the type passed.
122
+ new ethers.providers.Web3Provider(options.provider.currentProvider)
123
+ : options.provider.provider;
124
+ const network = await provider.getNetwork();
125
+ if (network.chainId !== chainId && chainId != null) {
126
+ throw new SFError({
127
+ type: "NETWORK_MISMATCH",
128
+ customMessage: "Your provider network chainId is: " +
129
+ network.chainId +
130
+ " whereas your desired chainId is: " +
131
+ chainId,
132
+ });
133
+ }
134
+ try {
135
+ const data = chainIdToDataMap.get(chainId) || {
136
+ subgraphAPIEndpoint: "",
137
+ resolverAddress: "",
138
+ networkName: "",
139
+ };
140
+ const resolverAddress = options.resolverAddress
141
+ ? options.resolverAddress
142
+ : data.resolverAddress;
143
+ const resolver = new ethers.Contract(resolverAddress, IResolverABI.abi, provider);
144
+ const superfluidLoaderAddress = await resolver.get("SuperfluidLoader-v1");
145
+ const superfluidLoader = new ethers.Contract(superfluidLoaderAddress, SuperfluidLoaderABI.abi, provider);
146
+ const framework = await superfluidLoader.loadFramework(releaseVersion);
147
+ const settings = {
148
+ chainId,
149
+ customSubgraphQueriesEndpoint,
150
+ dataMode: options.dataMode || "SUBGRAPH_ONLY",
151
+ protocolReleaseVersion: options.protocolReleaseVersion || "v1",
152
+ provider,
153
+ networkName,
154
+ config: {
155
+ hostAddress: framework.superfluid,
156
+ superTokenFactoryAddress: framework.superTokenFactory,
157
+ cfaV1Address: framework.agreementCFAv1,
158
+ idaV1Address: framework.agreementIDAv1,
159
+ },
160
+ };
161
+ return new Framework(options, settings);
162
+ }
163
+ catch (err) {
164
+ throw new SFError({
165
+ type: "FRAMEWORK_INITIALIZATION",
166
+ customMessage: "There was an error initializing the framework",
167
+ errorObject: err,
168
+ });
169
+ }
170
+ };
171
+ //# sourceMappingURL=Framework.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Framework.js","sourceRoot":"","sources":["../../src/Framework.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAE9E,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,mBAAmB,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EACH,cAAc,EACd,0BAA0B,EAC1B,mCAAmC,GACtC,MAAM,oBAAoB,CAAC;AAI5B,OAAO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AG,CAC9C,qBAAqB,CACxB,CAAC;QACF,MAAM,gBAAgB,GAAG,IAAI,MAAM,CAAC,QAAQ,CACxC,uBAAuB,EACvB,mBAAmB,CAAC,GAAG,EACvB,QAAQ,CACS,CAAC;QAEtB,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,aAAa,CAClD,cAAc,CACjB,CAAC;QAEF,MAAM,QAAQ,GAAuB;YACjC,OAAO;YACP,6BAA6B;YAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,eAAe;YAC7C,sBAAsB,EAAE,OAAO,CAAC,sBAAsB,IAAI,IAAI;YAC9D,QAAQ;YACR,WAAW;YACX,MAAM,EAAE;gBACJ,WAAW,EAAE,SAAS,CAAC,UAAU;gBACjC,wBAAwB,EAAE,SAAS,CAAC,iBAAiB;gBACrD,YAAY,EAAE,SAAS,CAAC,cAAc;gBACtC,YAAY,EAAE,SAAS,CAAC,cAAc;aACzC;SACJ,CAAC;QAEF,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;KAC3C;IAAC,OAAO,GAAG,EAAE;QACV,MAAM,IAAI,OAAO,CAAC;YACd,IAAI,EAAE,0BAA0B;YAChC,aAAa,EAAE,+CAA+C;YAC9D,WAAW,EAAE,GAAG;SACnB,CAAC,CAAC;KACN;AACL,CAAE,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { ethers } from "ethers";
1
2
  import Operation from "./Operation";
2
3
  import { Superfluid } from "./typechain";
3
4
  /**
@@ -12,7 +13,11 @@ export default class Host {
12
13
  * @param agreementAddress the agreement address (cfa or ida address)
13
14
  * @param callData the encoded callData for the function
14
15
  * @param userData any additional user data
16
+ * @param overrides ethers overrides object for more control over the transaction sent.
15
17
  * @returns {Operation} an `Operation` class
16
18
  */
17
- populateCallAgreementTxnAndReturnOperation: (agreementAddress: string, callData: string, userData: string | undefined) => Operation;
19
+ populateCallAgreementTxnAndReturnOperation: (agreementAddress: string, callData: string, userData: string | undefined, overrides?: (ethers.Overrides & {
20
+ from?: string | Promise<string> | undefined;
21
+ }) | undefined) => Operation;
18
22
  }
23
+ //# sourceMappingURL=Host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Host.d.ts","sourceRoot":"","sources":["../../src/Host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAa,MAAM,QAAQ,CAAC;AAE3C,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,IAAI;IACrB,YAAY,EAAE,UAAU,CAAC;gBAEb,WAAW,EAAE,MAAM;IAO/B;;;;;;;OAOG;IACH,0CAA0C,qBACpB,MAAM,YACd,MAAM,YACN,MAAM,GAAG,SAAS;;uBAE7B,SAAS,CAQV;CACL"}
@@ -0,0 +1,25 @@
1
+ import { ethers } from "ethers";
2
+ import Operation from "./Operation";
3
+ import SuperfluidABI from "./abi/Superfluid.json";
4
+ /**
5
+ * @dev Host Helper Class
6
+ * @description A helper class which can be used as a standalone class to populate call agreement transactions.
7
+ */
8
+ export default class Host {
9
+ constructor(hostAddress) {
10
+ /**
11
+ * @dev Creates an Operation of the `callAgreement` function on the host contract.
12
+ * @param agreementAddress the agreement address (cfa or ida address)
13
+ * @param callData the encoded callData for the function
14
+ * @param userData any additional user data
15
+ * @param overrides ethers overrides object for more control over the transaction sent.
16
+ * @returns {Operation} an `Operation` class
17
+ */
18
+ this.populateCallAgreementTxnAndReturnOperation = (agreementAddress, callData, userData, overrides) => {
19
+ const txn = this.hostContract.populateTransaction.callAgreement(agreementAddress, callData, userData || "0x", overrides || {});
20
+ return new Operation(txn, "SUPERFLUID_CALL_AGREEMENT");
21
+ };
22
+ this.hostContract = new ethers.Contract(hostAddress, SuperfluidABI.abi);
23
+ }
24
+ }
25
+ //# sourceMappingURL=Host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Host.js","sourceRoot":"","sources":["../../src/Host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAa,MAAM,QAAQ,CAAC;AAE3C,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,aAAa,MAAM,uBAAuB,CAAC;AAGlD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,IAAI;IAGrB,YAAY,WAAmB;QAO/B;;;;;;;WAOG;QACH,+CAA0C,GAAG,CACzC,gBAAwB,EACxB,QAAgB,EAChB,QAA4B,EAC5B,SAA2D,EAClD,EAAE;YACX,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,aAAa,CAC3D,gBAAgB,EAChB,QAAQ,EACR,QAAQ,IAAI,IAAI,EAChB,SAAS,IAAI,EAAE,CAClB,CAAC;YACF,OAAO,IAAI,SAAS,CAAC,GAAG,EAAE,2BAA2B,CAAC,CAAC;QAC3D,CAAC,CAAC;QA3BE,IAAI,CAAC,YAAY,GAAG,IAAI,MAAM,CAAC,QAAQ,CACnC,WAAW,EACX,aAAa,CAAC,GAAG,CACN,CAAC;IACpB,CAAC;CAwBJ"}
@@ -1,6 +1,6 @@
1
1
  import Host from "./Host";
2
2
  import Operation from "./Operation";
3
- import { IAgreementV1Options, IBaseIDAParams, IBaseSubscriptionParams, IDistributeParams, IGetIndexParams, IGetSubscriptionParams, IUpdateIndexValueParams, IUpdateSubscriptionUnitsParams, IWeb3Index, IWeb3Subscription } from "./interfaces";
3
+ import { IAgreementV1Options, IApproveSubscriptionParams, IClaimParams, ICreateIndexParams, IDeleteSubscriptionParams, IDistributeParams, IGetIndexParams, IGetSubscriptionParams, IRevokeSubscriptionParams, IUpdateIndexValueParams, IUpdateSubscriptionUnitsParams, IWeb3Index, IWeb3Subscription } from "./interfaces";
4
4
  /**
5
5
  * @dev Instant Distribution Agreement V1 Helper Class
6
6
  * @description A helper class to interact with the IDAV1 contract.
@@ -34,18 +34,20 @@ export default class InstantDistributionAgreementV1 {
34
34
  * @param indexId The id of the index.
35
35
  * @param superToken The address of the `index` superToken.
36
36
  * @param userData Extra user data provided.
37
+ * @param overrides ethers overrides object for more control over the transaction sent.
37
38
  * @returns {Operation} An instance of Operation which can be executed or batched.
38
39
  */
39
- createIndex: ({ indexId, superToken, userData, }: IBaseIDAParams) => Operation;
40
+ createIndex: ({ indexId, superToken, userData, overrides, }: ICreateIndexParams) => Operation;
40
41
  /**
41
42
  * @dev Distributes `amount` of `superToken` to an index
42
43
  * @param indexId The id of the index.
43
44
  * @param amount The amount of `superToken` to be distributed.
44
45
  * @param superToken The superToken to be distributed.
45
46
  * @param userData Extra user data provided.
47
+ * @param overrides ethers overrides object for more control over the transaction sent.
46
48
  * @returns {Operation} An instance of Operation which can be executed or batched.
47
49
  */
48
- distribute: ({ indexId, amount, superToken, userData, }: IDistributeParams) => Operation;
50
+ distribute: ({ indexId, amount, superToken, userData, overrides, }: IDistributeParams) => Operation;
49
51
  /**
50
52
  * @dev Updates the `indexValue` of an index.
51
53
  * @description NOTE: It has the same effect as `distribute`, but is closer to the low level data structure of the index.
@@ -53,9 +55,10 @@ export default class InstantDistributionAgreementV1 {
53
55
  * @param indexValue The new indexValue.
54
56
  * @param superToken The superToken to be distributed.
55
57
  * @param userData Extra user data provided.
58
+ * @param overrides ethers overrides object for more control over the transaction sent.
56
59
  * @returns {Operation} An instance of Operation which can be executed or batched.
57
60
  */
58
- updateIndexValue: ({ indexId, indexValue, superToken, userData, }: IUpdateIndexValueParams) => Operation;
61
+ updateIndexValue: ({ indexId, indexValue, superToken, userData, overrides, }: IUpdateIndexValueParams) => Operation;
59
62
  /**
60
63
  * @dev Updates the `units` allocated to a Subscription.
61
64
  * @param indexId The id of the index.
@@ -63,27 +66,30 @@ export default class InstantDistributionAgreementV1 {
63
66
  * @param subscriber The subscriber address whose units you want to update.
64
67
  * @param units The amount of units you want to update to.
65
68
  * @param userData Extra user data provided.
69
+ * @param overrides ethers overrides object for more control over the transaction sent.
66
70
  * @returns {Operation} An instance of Operation which can be executed or batched.
67
71
  */
68
- updateSubscriptionUnits: ({ indexId, superToken, subscriber, units, userData, }: IUpdateSubscriptionUnitsParams) => Operation;
72
+ updateSubscriptionUnits: ({ indexId, superToken, subscriber, units, userData, overrides, }: IUpdateSubscriptionUnitsParams) => Operation;
69
73
  /**
70
74
  * @dev Approves a Subscription, so the Subscriber won't need to claim tokens when the Publisher distributes.
71
75
  * @param indexId The id of the index.
72
76
  * @param superToken The superToken of the index.
73
77
  * @param publisher The publisher of the index you want to approve.
74
78
  * @param userData Extra user data provided.
79
+ * @param overrides ethers overrides object for more control over the transaction sent.
75
80
  * @returns {Operation} An instance of Operation which can be executed or batched.
76
81
  */
77
- approveSubscription: ({ indexId, superToken, publisher, userData, }: IBaseIDAParams) => Operation;
82
+ approveSubscription: ({ indexId, superToken, publisher, userData, overrides, }: IApproveSubscriptionParams) => Operation;
78
83
  /**
79
84
  * @dev Revokes a Subscription, so the Subscriber will need to claim tokens when the Publisher distributres.
80
85
  * @param indexId The id of the index.
81
86
  * @param superToken The superToken of the index.
82
87
  * @param subscriber The subscriber address whose subscription you want to revoke.
83
88
  * @param userData Extra user data provided.
89
+ * @param overrides ethers overrides object for more control over the transaction sent.
84
90
  * @returns {Operation} An instance of Operation which can be executed or batched.
85
91
  */
86
- revokeSubscription: ({ indexId, superToken, publisher, userData, }: IBaseIDAParams) => Operation;
92
+ revokeSubscription: ({ indexId, superToken, publisher, userData, overrides, }: IRevokeSubscriptionParams) => Operation;
87
93
  /**
88
94
  * @dev Deletes a Subscription by setting the `units` allocated to the Subscriber to 0.
89
95
  * @param indexId The id of the index.
@@ -91,9 +97,10 @@ export default class InstantDistributionAgreementV1 {
91
97
  * @param subscriber The subscriber address whose subscription you want to delete.
92
98
  * @param publisher The publisher address of the index you are targetting.
93
99
  * @param userData Extra user data provided.
100
+ * @param overrides ethers overrides object for more control over the transaction sent.
94
101
  * @returns {Operation} An instance of Operation which can be executed or batched.
95
102
  */
96
- deleteSubscription: ({ indexId, superToken, subscriber, publisher, userData, }: IBaseSubscriptionParams) => Operation;
103
+ deleteSubscription: ({ indexId, superToken, subscriber, publisher, userData, overrides, }: IDeleteSubscriptionParams) => Operation;
97
104
  /**
98
105
  * @dev Claims any pending tokens allocated to the Subscription (unapproved).
99
106
  * @param indexId The id of the index.
@@ -101,7 +108,9 @@ export default class InstantDistributionAgreementV1 {
101
108
  * @param subscriber The subscriber address whose subscription you want to delete.
102
109
  * @param publisher The publisher address of the index you are targetting.
103
110
  * @param userData Extra user data provided.
111
+ * @param overrides ethers overrides object for more control over the transaction sent.
104
112
  * @returns {Operation} An instance of Operation which can be executed or batched.
105
113
  */
106
- claim: ({ indexId, superToken, subscriber, publisher, userData, }: IBaseSubscriptionParams) => Operation;
114
+ claim: ({ indexId, superToken, subscriber, publisher, userData, overrides, }: IClaimParams) => Operation;
107
115
  }
116
+ //# sourceMappingURL=InstantDistributionAgreementV1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InstantDistributionAgreementV1.d.ts","sourceRoot":"","sources":["../../src/InstantDistributionAgreementV1.ts"],"names":[],"mappings":"AAEA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,SAAS,MAAM,aAAa,CAAC;AAGpC,OAAO,EACH,mBAAmB,EACnB,0BAA0B,EAC1B,YAAY,EACZ,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EACvB,8BAA8B,EAC9B,UAAU,EACV,iBAAiB,EACpB,MAAM,cAAc,CAAC;AAQtB;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,8BAA8B;IAC/C,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;gBAER,OAAO,EAAE,mBAAmB;IAKxC,OAAO,KAAK,WAAW,GAKtB;IAID;;;;;;;;OAQG;IACH,eAAe,sEAMZ,sBAAsB,KAAG,QAAQ,iBAAiB,CAAC,CA4BpD;IAEF;;;;;;;OAOG;IACH,QAAQ,0DAKL,eAAe,KAAG,QAAQ,UAAU,CAAC,CAoBtC;IAIF;;;;;;;OAOG;IACH,WAAW,kDAKR,kBAAkB,KAAG,SAAS,CAc/B;IAEF;;;;;;;;OAQG;IACH,UAAU,0DAMP,iBAAiB,KAAG,SAAS,CAe9B;IAEF;;;;;;;;;OASG;IACH,gBAAgB,8DAMb,uBAAuB,KAAG,SAAS,CAepC;IAEF;;;;;;;;;OASG;IACH,uBAAuB,qEAOpB,8BAA8B,KAAG,SAAS,CAiB3C;IAEF;;;;;;;;OAQG;IACH,mBAAmB,6DAMhB,0BAA0B,KAAG,SAAS,CAcvC;IAEF;;;;;;;;OAQG;IACH,kBAAkB,6DAMf,yBAAyB,KAAG,SAAS,CAgBtC;IAEF;;;;;;;;;OASG;IACH,kBAAkB,yEAOf,yBAAyB,KAAG,SAAS,CAkBtC;IAEF;;;;;;;;;OASG;IACH,KAAK,yEAOF,YAAY,KAAG,SAAS,CAkBzB;CACL"}
@@ -0,0 +1,243 @@
1
+ import { ethers } from "ethers";
2
+ import Host from "./Host";
3
+ import SFError from "./SFError";
4
+ import IInstantDistributionAgreementV1ABI from "./abi/IInstantDistributionAgreementV1.json";
5
+ import { normalizeAddress } from "./utils";
6
+ const idaInterface = new ethers.utils.Interface(IInstantDistributionAgreementV1ABI.abi);
7
+ /**
8
+ * @dev Instant Distribution Agreement V1 Helper Class
9
+ * @description A helper class to interact with the IDAV1 contract.
10
+ */
11
+ export default class InstantDistributionAgreementV1 {
12
+ constructor(options) {
13
+ // IDA Read Functions
14
+ /**
15
+ * @dev Get the details of a `Subscription`.
16
+ * @param superToken the superToken of the agreement
17
+ * @param publisher the address of the publisher of the index
18
+ * @param indexId the index id
19
+ * @param subscriber the subscriber's address
20
+ * @param providerOrSigner a provider or signer object
21
+ * @returns {Promise<IWeb3Subscription>} Web3 Subscription object
22
+ */
23
+ this.getSubscription = async ({ superToken, publisher, indexId, subscriber, providerOrSigner, }) => {
24
+ const normalizedToken = normalizeAddress(superToken);
25
+ const normalizedPublisher = normalizeAddress(publisher);
26
+ const normalizedSubscriber = normalizeAddress(subscriber);
27
+ try {
28
+ const subscription = await this.idaContract
29
+ .connect(providerOrSigner)
30
+ .getSubscription(normalizedToken, normalizedPublisher, indexId, normalizedSubscriber);
31
+ return {
32
+ exist: subscription.exist,
33
+ approved: subscription.approved,
34
+ units: subscription.units.toString(),
35
+ pendingDistribution: subscription.pendingDistribution.toString(),
36
+ };
37
+ }
38
+ catch (err) {
39
+ throw new SFError({
40
+ type: "IDAV1_READ",
41
+ customMessage: "There was an error getting the subscription",
42
+ errorObject: err,
43
+ });
44
+ }
45
+ };
46
+ /**
47
+ * @dev Get the details of an `Index`.
48
+ * @param superToken the superToken of the agreement
49
+ * @param publisher the address of the publisher of the index
50
+ * @param indexId the index id
51
+ * @param providerOrSigner a provider or signer object
52
+ * @returns {Promise<IWeb3Index>} Web3 Index object
53
+ */
54
+ this.getIndex = async ({ superToken, publisher, indexId, providerOrSigner, }) => {
55
+ const normalizedToken = normalizeAddress(superToken);
56
+ const normalizedPublisher = normalizeAddress(publisher);
57
+ try {
58
+ const index = await this.idaContract
59
+ .connect(providerOrSigner)
60
+ .getIndex(normalizedToken, normalizedPublisher, indexId);
61
+ return {
62
+ exist: index.exist,
63
+ indexValue: index.indexValue.toString(),
64
+ totalUnitsApproved: index.totalUnitsApproved.toString(),
65
+ totalUnitsPending: index.totalUnitsPending.toString(),
66
+ };
67
+ }
68
+ catch (err) {
69
+ throw new SFError({
70
+ type: "IDAV1_READ",
71
+ customMessage: "There was an error getting the index",
72
+ errorObject: err,
73
+ });
74
+ }
75
+ };
76
+ // IDA Write Functions
77
+ /**
78
+ * @dev Creates an IDA Index.
79
+ * @param indexId The id of the index.
80
+ * @param superToken The address of the `index` superToken.
81
+ * @param userData Extra user data provided.
82
+ * @param overrides ethers overrides object for more control over the transaction sent.
83
+ * @returns {Operation} An instance of Operation which can be executed or batched.
84
+ */
85
+ this.createIndex = ({ indexId, superToken, userData, overrides, }) => {
86
+ const normalizedToken = normalizeAddress(superToken);
87
+ const callData = idaInterface.encodeFunctionData("createIndex", [
88
+ normalizedToken,
89
+ indexId,
90
+ "0x",
91
+ ]);
92
+ return this.host.populateCallAgreementTxnAndReturnOperation(this.options.config.idaV1Address, callData, userData, overrides);
93
+ };
94
+ /**
95
+ * @dev Distributes `amount` of `superToken` to an index
96
+ * @param indexId The id of the index.
97
+ * @param amount The amount of `superToken` to be distributed.
98
+ * @param superToken The superToken to be distributed.
99
+ * @param userData Extra user data provided.
100
+ * @param overrides ethers overrides object for more control over the transaction sent.
101
+ * @returns {Operation} An instance of Operation which can be executed or batched.
102
+ */
103
+ this.distribute = ({ indexId, amount, superToken, userData, overrides, }) => {
104
+ const normalizedToken = normalizeAddress(superToken);
105
+ const callData = idaInterface.encodeFunctionData("distribute", [
106
+ normalizedToken,
107
+ indexId,
108
+ amount,
109
+ "0x",
110
+ ]);
111
+ return this.host.populateCallAgreementTxnAndReturnOperation(this.options.config.idaV1Address, callData, userData, overrides);
112
+ };
113
+ /**
114
+ * @dev Updates the `indexValue` of an index.
115
+ * @description NOTE: It has the same effect as `distribute`, but is closer to the low level data structure of the index.
116
+ * @param indexId The id of the index.
117
+ * @param indexValue The new indexValue.
118
+ * @param superToken The superToken to be distributed.
119
+ * @param userData Extra user data provided.
120
+ * @param overrides ethers overrides object for more control over the transaction sent.
121
+ * @returns {Operation} An instance of Operation which can be executed or batched.
122
+ */
123
+ this.updateIndexValue = ({ indexId, indexValue, superToken, userData, overrides, }) => {
124
+ const normalizedToken = normalizeAddress(superToken);
125
+ const callData = idaInterface.encodeFunctionData("updateIndex", [
126
+ normalizedToken,
127
+ indexId,
128
+ indexValue,
129
+ "0x",
130
+ ]);
131
+ return this.host.populateCallAgreementTxnAndReturnOperation(this.options.config.idaV1Address, callData, userData, overrides);
132
+ };
133
+ /**
134
+ * @dev Updates the `units` allocated to a Subscription.
135
+ * @param indexId The id of the index.
136
+ * @param superToken The superToken of the index.
137
+ * @param subscriber The subscriber address whose units you want to update.
138
+ * @param units The amount of units you want to update to.
139
+ * @param userData Extra user data provided.
140
+ * @param overrides ethers overrides object for more control over the transaction sent.
141
+ * @returns {Operation} An instance of Operation which can be executed or batched.
142
+ */
143
+ this.updateSubscriptionUnits = ({ indexId, superToken, subscriber, units, userData, overrides, }) => {
144
+ const normalizedToken = normalizeAddress(superToken);
145
+ const normalizedSubscriber = normalizeAddress(subscriber);
146
+ const callData = idaInterface.encodeFunctionData("updateSubscription", [
147
+ normalizedToken,
148
+ indexId,
149
+ normalizedSubscriber,
150
+ units,
151
+ "0x",
152
+ ]);
153
+ return this.host.populateCallAgreementTxnAndReturnOperation(this.options.config.idaV1Address, callData, userData, overrides);
154
+ };
155
+ /**
156
+ * @dev Approves a Subscription, so the Subscriber won't need to claim tokens when the Publisher distributes.
157
+ * @param indexId The id of the index.
158
+ * @param superToken The superToken of the index.
159
+ * @param publisher The publisher of the index you want to approve.
160
+ * @param userData Extra user data provided.
161
+ * @param overrides ethers overrides object for more control over the transaction sent.
162
+ * @returns {Operation} An instance of Operation which can be executed or batched.
163
+ */
164
+ this.approveSubscription = ({ indexId, superToken, publisher, userData, overrides, }) => {
165
+ const normalizedPublisher = normalizeAddress(publisher);
166
+ const normalizedToken = normalizeAddress(superToken);
167
+ const callData = idaInterface.encodeFunctionData("approveSubscription", [normalizedToken, normalizedPublisher, indexId, "0x"]);
168
+ return this.host.populateCallAgreementTxnAndReturnOperation(this.options.config.idaV1Address, callData, userData, overrides);
169
+ };
170
+ /**
171
+ * @dev Revokes a Subscription, so the Subscriber will need to claim tokens when the Publisher distributres.
172
+ * @param indexId The id of the index.
173
+ * @param superToken The superToken of the index.
174
+ * @param subscriber The subscriber address whose subscription you want to revoke.
175
+ * @param userData Extra user data provided.
176
+ * @param overrides ethers overrides object for more control over the transaction sent.
177
+ * @returns {Operation} An instance of Operation which can be executed or batched.
178
+ */
179
+ this.revokeSubscription = ({ indexId, superToken, publisher, userData, overrides, }) => {
180
+ const normalizedPublisher = normalizeAddress(publisher);
181
+ const normalizedToken = normalizeAddress(superToken);
182
+ const callData = idaInterface.encodeFunctionData("revokeSubscription", [
183
+ normalizedToken,
184
+ normalizedPublisher,
185
+ indexId,
186
+ "0x",
187
+ ]);
188
+ return this.host.populateCallAgreementTxnAndReturnOperation(this.options.config.idaV1Address, callData, userData, overrides);
189
+ };
190
+ /**
191
+ * @dev Deletes a Subscription by setting the `units` allocated to the Subscriber to 0.
192
+ * @param indexId The id of the index.
193
+ * @param superToken The superToken of the index.
194
+ * @param subscriber The subscriber address whose subscription you want to delete.
195
+ * @param publisher The publisher address of the index you are targetting.
196
+ * @param userData Extra user data provided.
197
+ * @param overrides ethers overrides object for more control over the transaction sent.
198
+ * @returns {Operation} An instance of Operation which can be executed or batched.
199
+ */
200
+ this.deleteSubscription = ({ indexId, superToken, subscriber, publisher, userData, overrides, }) => {
201
+ const normalizedPublisher = normalizeAddress(publisher);
202
+ const normalizedToken = normalizeAddress(superToken);
203
+ const normalizedSubscriber = normalizeAddress(subscriber);
204
+ const callData = idaInterface.encodeFunctionData("deleteSubscription", [
205
+ normalizedToken,
206
+ normalizedPublisher,
207
+ indexId,
208
+ normalizedSubscriber,
209
+ "0x",
210
+ ]);
211
+ return this.host.populateCallAgreementTxnAndReturnOperation(this.options.config.idaV1Address, callData, userData, overrides);
212
+ };
213
+ /**
214
+ * @dev Claims any pending tokens allocated to the Subscription (unapproved).
215
+ * @param indexId The id of the index.
216
+ * @param superToken The superToken of the index.
217
+ * @param subscriber The subscriber address whose subscription you want to delete.
218
+ * @param publisher The publisher address of the index you are targetting.
219
+ * @param userData Extra user data provided.
220
+ * @param overrides ethers overrides object for more control over the transaction sent.
221
+ * @returns {Operation} An instance of Operation which can be executed or batched.
222
+ */
223
+ this.claim = ({ indexId, superToken, subscriber, publisher, userData, overrides, }) => {
224
+ const normalizedPublisher = normalizeAddress(publisher);
225
+ const normalizedToken = normalizeAddress(superToken);
226
+ const normalizedSubscriber = normalizeAddress(subscriber);
227
+ const callData = idaInterface.encodeFunctionData("claim", [
228
+ normalizedToken,
229
+ normalizedPublisher,
230
+ indexId,
231
+ normalizedSubscriber,
232
+ "0x",
233
+ ]);
234
+ return this.host.populateCallAgreementTxnAndReturnOperation(this.options.config.idaV1Address, callData, userData, overrides);
235
+ };
236
+ this.options = options;
237
+ this.host = new Host(options.config.hostAddress);
238
+ }
239
+ get idaContract() {
240
+ return new ethers.Contract(this.options.config.idaV1Address, IInstantDistributionAgreementV1ABI.abi);
241
+ }
242
+ }
243
+ //# sourceMappingURL=InstantDistributionAgreementV1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InstantDistributionAgreementV1.js","sourceRoot":"","sources":["../../src/InstantDistributionAgreementV1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAE1B,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,kCAAkC,MAAM,4CAA4C,CAAC;AAiB5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,CAC3C,kCAAkC,CAAC,GAAG,CACzC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,8BAA8B;IAI/C,YAAY,OAA4B;QAYxC,qBAAqB;QAErB;;;;;;;;WAQG;QACH,oBAAe,GAAG,KAAK,EAAE,EACrB,UAAU,EACV,SAAS,EACT,OAAO,EACP,UAAU,EACV,gBAAgB,GACK,EAA8B,EAAE;YACrD,MAAM,eAAe,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;YACrD,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;YACxD,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,UAAU,CAAC,C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ChC,QAAQ,EACR,QAAQ,EACR,SAAS,CACZ,CAAC;QACN,CAAC,CAAC;QAEF;;;;;;;;;WASG;QACH,UAAK,GAAG,CAAC,EACL,OAAO,EACP,UAAU,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,SAAS,GACE,EAAa,EAAE;YAC1B,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;YACxD,MAAM,eAAe,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;YACrD,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;YAC1D,MAAM,QAAQ,GAAG,YAAY,CAAC,kBAAkB,CAAC,OAAO,EAAE;gBACtD,eAAe;gBACf,mBAAmB;gBACnB,OAAO;gBACP,oBAAoB;gBACpB,IAAI;aACP,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC,IAAI,CAAC,0CAA0C,CACvD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAChC,QAAQ,EACR,QAAQ,EACR,SAAS,CACZ,CAAC;QACN,CAAC,CAAC;QAzWE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACrD,CAAC;IAED,IAAY,WAAW;QACnB,OAAO,IAAI,MAAM,CAAC,QAAQ,CACtB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAChC,kCAAkC,CAAC,GAAG,CACN,CAAC;IACzC,CAAC;CAiWJ"}
@@ -36,3 +36,4 @@ export default class Operation {
36
36
  */
37
37
  getTransactionHash: (signer: ethers.Signer) => Promise<string>;
38
38
  }
39
+ //# sourceMappingURL=Operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Operation.d.ts","sourceRoot":"","sources":["../../src/Operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,oBAAY,aAAa,GACnB,aAAa,GACb,eAAe,GACf,qBAAqB,GACrB,oBAAoB,GACpB,sBAAsB,GACtB,2BAA2B,GAC3B,iBAAiB,CAAC;AAExB;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC1B,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAC1E,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;gBAGzB,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,EACzC,IAAI,EAAE,aAAa;IAMvB;;;;;OAKG;IACH,IAAI,WACQ,OAAO,MAAM,KACtB,QAAQ,OAAO,SAAS,CAAC,mBAAmB,CAAC,CAY9C;IAEF;;;;OAIG;IACH,8BAA8B,WAClB,OAAO,MAAM,KACtB,QAAQ,kBAAkB,CAAC,CAY5B;IACF;;;;OAIG;IACH,oBAAoB,WAAkB,OAAO,MAAM,KAAG,QAAQ,MAAM,CAAC,CAenE;IAEF;;;;;OAKG;IACH,kBAAkB,WAAkB,OAAO,MAAM,KAAG,QAAQ,MAAM,CAAC,CAGjE;CACL"}