@superfluid-finance/sdk-core 0.1.1-dev.fa49a94.0 → 0.2.1-dev.64549c3.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 +124 -53
  2. package/dist/index.umd.js +63560 -0
  3. package/dist/main/BatchCall.d.ts +2 -2
  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 +181 -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 +311 -0
  30. package/dist/main/Query.js.map +1 -0
  31. package/dist/main/SFError.d.ts +3 -2
  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 +398 -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 +10 -2
  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 +90 -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 -7524
  65. package/dist/main/index.js.map +1 -0
  66. package/dist/main/interfaces.d.ts +100 -11
  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 +18 -3
  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 +9 -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 +16 -2
  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 +23 -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 +2 -2
  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 +175 -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 +305 -0
  225. package/dist/module/Query.js.map +1 -0
  226. package/dist/module/SFError.d.ts +3 -2
  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 +392 -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 +10 -2
  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 +81 -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 -7490
  260. package/dist/module/index.js.map +1 -0
  261. package/dist/module/interfaces.d.ts +100 -11
  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 +18 -3
  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 +9 -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 +16 -2
  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 +23 -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 +48 -34
  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 -10
  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 -7526
  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 -57
  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 -207
  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 -22
  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 -89
  440. package/dist/umd/validation.d.ts +0 -8
@@ -0,0 +1,172 @@
1
+ import { ethers } from "ethers";
2
+ import Host from "./Host";
3
+ import SFError from "./SFError";
4
+ import IConstantFlowAgreementV1ABI from "./abi/IConstantFlowAgreementV1.json";
5
+ import { getSanitizedTimestamp, normalizeAddress } from "./utils";
6
+ const cfaInterface = new ethers.utils.Interface(IConstantFlowAgreementV1ABI.abi);
7
+ /**
8
+ * @dev Constant Flow Agreement V1 Helper Class
9
+ * @description A helper class to interact with the CFAV1 contract.
10
+ */
11
+ export default class ConstantFlowAgreementV1 {
12
+ constructor(options) {
13
+ // CFA Read Functions
14
+ /**
15
+ * @dev Get the details of a flow.
16
+ * @param superToken the superToken of the agreement
17
+ * @param sender the sender of the flow
18
+ * @param receiver the receiver of the flow
19
+ * @param providerOrSigner a provider or signer object
20
+ * @returns {Promise<IWeb3FlowInfo>} Web3 Flow info object
21
+ */
22
+ this.getFlow = async ({ superToken, sender, receiver, providerOrSigner, }) => {
23
+ const normalizedToken = normalizeAddress(superToken);
24
+ const normalizedSender = normalizeAddress(sender);
25
+ const normalizedReceiver = normalizeAddress(receiver);
26
+ try {
27
+ const flowData = await this.cfaContract
28
+ .connect(providerOrSigner)
29
+ .getFlow(normalizedToken, normalizedSender, normalizedReceiver);
30
+ return this._sanitizeflowInfo(flowData);
31
+ }
32
+ catch (err) {
33
+ throw new SFError({
34
+ type: "CFAV1_READ",
35
+ customMessage: "There was an error getting the flow",
36
+ errorObject: err,
37
+ });
38
+ }
39
+ };
40
+ /**
41
+ * @dev Get the flow info of an account (net flow).
42
+ * @param superToken the superToken of the agreement
43
+ * @param account the account we're querying
44
+ * @param providerOrSigner a provider or signer object
45
+ * @returns {Promise<IWeb3FlowInfo>} Web3 Flow info object
46
+ */
47
+ this.getAccountFlowInfo = async ({ superToken, account, providerOrSigner, }) => {
48
+ const normalizedToken = normalizeAddress(superToken);
49
+ const normalizedAccount = normalizeAddress(account);
50
+ try {
51
+ const flowData = await this.cfaContract
52
+ .connect(providerOrSigner)
53
+ .getAccountFlowInfo(normalizedToken, normalizedAccount);
54
+ return this._sanitizeflowInfo(flowData);
55
+ }
56
+ catch (err) {
57
+ throw new SFError({
58
+ type: "CFAV1_READ",
59
+ customMessage: "There was an error getting the account flow information",
60
+ errorObject: err,
61
+ });
62
+ }
63
+ };
64
+ /**
65
+ * @dev Get the net flow of an account.
66
+ * @param superToken the superToken of the agreement
67
+ * @param account the account we're querying
68
+ * @param providerOrSigner a provider or signer object
69
+ * @returns {Promise<string>} Web3 Flow info object
70
+ */
71
+ this.getNetFlow = async ({ superToken, account, providerOrSigner, }) => {
72
+ const normalizedToken = normalizeAddress(superToken);
73
+ const normalizedAccount = normalizeAddress(account);
74
+ try {
75
+ return (await this.cfaContract
76
+ .connect(providerOrSigner)
77
+ .getNetFlow(normalizedToken, normalizedAccount)).toString();
78
+ }
79
+ catch (err) {
80
+ throw new SFError({
81
+ type: "CFAV1_READ",
82
+ customMessage: "There was an error getting net flow",
83
+ errorObject: err,
84
+ });
85
+ }
86
+ };
87
+ // CFA Write Functions
88
+ /**
89
+ * @dev Create a flow.
90
+ * @param flowRate The specified flow rate.
91
+ * @param receiver The receiver of the flow.
92
+ * @param superToken The token to be flowed.
93
+ * @param userData Extra user data provided.
94
+ * @param overrides ethers overrides object for more control over the transaction sent.
95
+ * @returns {Operation} An instance of Operation which can be executed or batched.
96
+ */
97
+ this.createFlow = ({ flowRate, receiver, superToken, userData, overrides, }) => {
98
+ const normalizedToken = normalizeAddress(superToken);
99
+ const normalizedReceiver = normalizeAddress(receiver);
100
+ const callData = cfaInterface.encodeFunctionData("createFlow", [
101
+ normalizedToken,
102
+ normalizedReceiver,
103
+ flowRate,
104
+ "0x",
105
+ ]);
106
+ return this.host.populateCallAgreementTxnAndReturnOperation(this.options.config.cfaV1Address, callData, userData, overrides);
107
+ };
108
+ /**
109
+ * @dev Update a flow.
110
+ * @param flowRate The specified flow rate.
111
+ * @param receiver The receiver of the flow.
112
+ * @param superToken The token to be flowed.
113
+ * @param userData Extra user data provided.
114
+ * @param overrides ethers overrides object for more control over the transaction sent.
115
+ * @returns {Operation} An instance of Operation which can be executed or batched.
116
+ */
117
+ this.updateFlow = ({ flowRate, receiver, superToken, userData, overrides, }) => {
118
+ const normalizedToken = normalizeAddress(superToken);
119
+ const normalizedReceiver = normalizeAddress(receiver);
120
+ const callData = cfaInterface.encodeFunctionData("updateFlow", [
121
+ normalizedToken,
122
+ normalizedReceiver,
123
+ flowRate,
124
+ "0x",
125
+ ]);
126
+ return this.host.populateCallAgreementTxnAndReturnOperation(this.options.config.cfaV1Address, callData, userData, overrides);
127
+ };
128
+ /**
129
+ * @dev Delete a flow.
130
+ * @param superToken The token to be flowed.
131
+ * @param sender The sender of the flow.
132
+ * @param receiver The receiver of the flow.
133
+ * @param userData Extra user data provided.
134
+ * @param overrides ethers overrides object for more control over the transaction sent.
135
+ * @returns {Operation} An instance of Operation which can be executed or batched.
136
+ */
137
+ this.deleteFlow = ({ superToken, sender, receiver, userData, overrides, }) => {
138
+ const normalizedToken = normalizeAddress(superToken);
139
+ const normalizedSender = normalizeAddress(sender);
140
+ const normalizedReceiver = normalizeAddress(receiver);
141
+ const callData = cfaInterface.encodeFunctionData("deleteFlow", [
142
+ normalizedToken,
143
+ normalizedSender,
144
+ normalizedReceiver,
145
+ "0x",
146
+ ]);
147
+ return this.host.populateCallAgreementTxnAndReturnOperation(this.options.config.cfaV1Address, callData, userData, overrides);
148
+ };
149
+ /**
150
+ * @dev Sanitizes flow info, converting BigNumber to string.
151
+ * @param timestamp last updated timestamp of flow
152
+ * @param flowRate the current flow rate
153
+ * @param deposit the deposit amount
154
+ * @param owedDeposit any owed depsit
155
+ * @returns {IWeb3FlowInfo} sanitized web3 flow info
156
+ */
157
+ this._sanitizeflowInfo = ({ timestamp, flowRate, deposit, owedDeposit, }) => {
158
+ return {
159
+ timestamp: getSanitizedTimestamp(timestamp),
160
+ flowRate: flowRate.toString(),
161
+ deposit: deposit.toString(),
162
+ owedDeposit: owedDeposit.toString(),
163
+ };
164
+ };
165
+ this.options = options;
166
+ this.host = new Host(options.config.hostAddress);
167
+ }
168
+ get cfaContract() {
169
+ return new ethers.Contract(this.options.config.cfaV1Address, IConstantFlowAgreementV1ABI.abi);
170
+ }
171
+ }
172
+ //# sourceMappingURL=ConstantFlowAgreementV1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConstantFlowAgreementV1.js","sourceRoot":"","sources":["../../src/ConstantFlowAgreementV1.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,2BAA2B,MAAM,qCAAqC,CAAC;AAY9E,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAElE,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,CAC3C,2BAA2B,CAAC,GAAG,CAClC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,uBAAuB;IAIxC,YAAY,OAA4B;QAYxC,qBAAqB;QAErB;;;;;;;WAOG;QACH,YAAO,GAAG,KAAK,EAAE,EACb,UAAU,EACV,MAAM,EACN,QAAQ,EACR,gBAAgB,GACH,EAA0B,EAAE;YACz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AC,QAAQ,EAAE;aACtC,CAAC;QACN,CAAC,CAAC;QAnOE,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,2BAA2B,CAAC,GAAG,CACN,CAAC;IAClC,CAAC;CA2NJ"}
@@ -1,5 +1,7 @@
1
1
  import { Signer } from "@ethersproject/abstract-signer";
2
+ import { HardhatEthersHelpers } from "@nomiclabs/hardhat-ethers/types";
2
3
  import { ethers } from "ethers";
4
+ import Web3 from "web3";
3
5
  import BatchCall from "./BatchCall";
4
6
  import ConstantFlowAgreementV1 from "./ConstantFlowAgreementV1";
5
7
  import Host from "./Host";
@@ -9,6 +11,7 @@ import Query from "./Query";
9
11
  import SuperToken from "./SuperToken";
10
12
  import { IConfig, ISignerConstructorOptions } from "./interfaces";
11
13
  import { DataMode } from "./types";
14
+ declare type SupportedProvider = ethers.providers.Provider | (typeof ethers & HardhatEthersHelpers) | Web3;
12
15
  export interface IFrameworkOptions {
13
16
  chainId?: number;
14
17
  customSubgraphQueriesEndpoint?: string;
@@ -16,7 +19,7 @@ export interface IFrameworkOptions {
16
19
  networkName?: string;
17
20
  resolverAddress?: string;
18
21
  protocolReleaseVersion?: string;
19
- provider: ethers.providers.Provider;
22
+ provider: SupportedProvider;
20
23
  }
21
24
  export interface IFrameworkSettings {
22
25
  chainId: number;
@@ -47,7 +50,7 @@ export default class Framework {
47
50
  * @param options.networkName the desired network (e.g. "matic", "rinkeby", etc.)
48
51
  * @param options.resolverAddress a custom resolver address (advanced use for testing)
49
52
  * @param options.protocolReleaseVersion a custom release version (advanced use for testing)
50
- * @param options.provider a provider object necessary for initializing the framework
53
+ * @param options.provider a provider object (injected web3, injected ethers, ethers provider) necessary for initializing the framework
51
54
  * @returns `Framework` class
52
55
  */
53
56
  static create: (options: IFrameworkOptions) => Promise<Framework>;
@@ -73,3 +76,5 @@ export default class Framework {
73
76
  */
74
77
  loadSuperToken: (address: string) => Promise<SuperToken>;
75
78
  }
79
+ export {};
80
+ //# sourceMappingURL=Framework.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Framework.d.ts","sourceRoot":"","sources":["../../src/Framework.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAC9E,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B,OAAO,UAAU,MAAM,cAAc,CAAC;AAStC,OAAO,EAAE,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAElE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGnC,aAAK,iBAAiB,GAChB,MAAM,CAAC,SAAS,CAAC,QAAQ,GACzB,CAAC,OAAO,MAAM,GAAG,oBAAoB,CAAC,GACtC,IAAI,CAAC;AAIX,MAAM,WAAW,iBAAiB;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,EAAE,iBAAiB,CAAC;CAC/B;AAED,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,6BAA6B,EAAE,MAAM,CAAC;IACtC,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;IACpC,MAAM,EAAE,OAAO,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;IAC7C,QAAQ,EAAE,kBAAkB,CAAC;IAE7B,KAAK,EAAE,uBAAuB,CAAC;IAC/B,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,8BAA8B,CAAC;IACtC,KAAK,EAAE,KAAK,CAAC;IAEb,OAAO;IAiBP;;;;;;;;;;OAUG;IACH,MAAM,CAAC,MAAM,YAAmB,iBAAiB,wBA+F/C;IAEF;;;;;;;OAOG;IACH,YAAY,YAAa,yBAAyB,KAAG,MAAM,CAqCzD;IAEF;;;;OAIG;IACH,SAAS,eAAgB,SAAS,EAAE,eAKlC;IAEF;;;;OAIG;IACH,cAAc,YAAmB,MAAM,KAAG,QAAQ,UAAU,CAAC,CAE3D;CACL"}
@@ -0,0 +1,175 @@
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 { chainIdToResolverDataMap, 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({
69
+ operations,
70
+ hostAddress: this.settings.config.hostAddress,
71
+ });
72
+ };
73
+ /**
74
+ * @dev Load a `SuperToken` class from the `Framework`.
75
+ * @param address the `SuperToken` address
76
+ * @returns `SuperToken` class
77
+ */
78
+ this.loadSuperToken = async (address) => {
79
+ return await SuperToken.create({ ...this.settings, address });
80
+ };
81
+ this.userInputOptions = options;
82
+ this.settings = settings;
83
+ this.cfaV1 = new ConstantFlowAgreementV1({
84
+ config: this.settings.config,
85
+ });
86
+ this.host = new Host(this.settings.config.hostAddress);
87
+ this.idaV1 = new InstantDistributionAgreementV1({
88
+ config: this.settings.config,
89
+ });
90
+ this.query = new Query(this.settings);
91
+ }
92
+ }
93
+ _a = Framework;
94
+ /**
95
+ * @dev Creates the Framework object based on user provided `options`.
96
+ * @param options.chainId the chainId of your desired network (e.g. 137 = matic)
97
+ * @param options.customSubgraphQueriesEndpoint your custom subgraph endpoint
98
+ * @param options.dataMode the data mode you'd like the framework to use (SUBGRAPH_ONLY, SUBGRAPH_WEB3, WEB3_ONLY)
99
+ * @param options.networkName the desired network (e.g. "matic", "rinkeby", etc.)
100
+ * @param options.resolverAddress a custom resolver address (advanced use for testing)
101
+ * @param options.protocolReleaseVersion a custom release version (advanced use for testing)
102
+ * @param options.provider a provider object (injected web3, injected ethers, ethers provider) necessary for initializing the framework
103
+ * @returns `Framework` class
104
+ */
105
+ Framework.create = async (options) => {
106
+ validateFrameworkConstructorOptions({
107
+ ...options,
108
+ dataMode: options.dataMode || "SUBGRAPH_ONLY",
109
+ protocolReleaseVersion: options.protocolReleaseVersion || "v1",
110
+ });
111
+ const networkName = getNetworkName(options);
112
+ const chainId =
113
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
114
+ options.chainId || networkNameToChainIdMap.get(networkName);
115
+ const releaseVersion = options.protocolReleaseVersion || "v1";
116
+ // NOTE: endpoint can be empty in WEB3_ONLY mode
117
+ const customSubgraphQueriesEndpoint = options.dataMode === "WEB3_ONLY"
118
+ ? ""
119
+ : options.customSubgraphQueriesEndpoint ||
120
+ getSubgraphQueriesEndpoint(options);
121
+ const provider = isEthersProvider(options.provider)
122
+ ? options.provider
123
+ : isInjectedWeb3(options.provider)
124
+ ? // must explicitly cast web3 provider type because
125
+ // ethers.providers.Web3Provider doesn't like
126
+ // the type passed.
127
+ new ethers.providers.Web3Provider(options.provider.currentProvider)
128
+ : options.provider.provider;
129
+ const network = await provider.getNetwork();
130
+ if (network.chainId !== chainId && chainId != null) {
131
+ throw new SFError({
132
+ type: "NETWORK_MISMATCH",
133
+ customMessage: "Your provider network chainId is: " +
134
+ network.chainId +
135
+ " whereas your desired chainId is: " +
136
+ chainId,
137
+ });
138
+ }
139
+ try {
140
+ const resolverData = chainIdToResolverDataMap.get(chainId) || {
141
+ subgraphAPIEndpoint: "",
142
+ resolverAddress: "",
143
+ networkName: "",
144
+ };
145
+ const resolverAddress = options.resolverAddress
146
+ ? options.resolverAddress
147
+ : resolverData.resolverAddress;
148
+ const resolver = new ethers.Contract(resolverAddress, IResolverABI.abi, provider);
149
+ const superfluidLoaderAddress = await resolver.get("SuperfluidLoader-v1");
150
+ const superfluidLoader = new ethers.Contract(superfluidLoaderAddress, SuperfluidLoaderABI.abi, provider);
151
+ const framework = await superfluidLoader.loadFramework(releaseVersion);
152
+ const settings = {
153
+ chainId,
154
+ customSubgraphQueriesEndpoint,
155
+ dataMode: options.dataMode || "SUBGRAPH_ONLY",
156
+ protocolReleaseVersion: options.protocolReleaseVersion || "v1",
157
+ provider,
158
+ networkName,
159
+ config: {
160
+ hostAddress: framework.superfluid,
161
+ cfaV1Address: framework.agreementCFAv1,
162
+ idaV1Address: framework.agreementIDAv1,
163
+ },
164
+ };
165
+ return new Framework(options, settings);
166
+ }
167
+ catch (err) {
168
+ throw new SFError({
169
+ type: "FRAMEWORK_INITIALIZATION",
170
+ customMessage: "There was an error initializing the framework",
171
+ errorObject: err,
172
+ });
173
+ }
174
+ };
175
+ //# 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,M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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,OAA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