@superfluid-finance/sdk-core 0.1.0 → 0.1.1-dev.087c350.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 +453 -76
  2. package/dist/index.umd.js +45852 -0
  3. package/dist/main/BatchCall.d.ts +2 -1
  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 +9 -5
  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 +12 -7
  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 +19 -10
  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 +4 -3
  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 +36 -16
  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 +8 -4
  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 +9 -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 +11 -5
  63. package/dist/main/index.d.ts.map +1 -0
  64. package/dist/main/index.js +38 -7522
  65. package/dist/main/index.js.map +1 -0
  66. package/dist/main/interfaces.d.ts +103 -16
  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 +2 -1
  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 +3 -2
  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 +5 -4
  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 +34 -42
  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 +2 -1
  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 -1
  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 +9 -5
  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 +12 -7
  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 +19 -10
  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 +4 -3
  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 +36 -16
  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 +8 -4
  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 +9 -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 +11 -5
  258. package/dist/module/index.d.ts.map +1 -0
  259. package/dist/module/index.js +25 -7488
  260. package/dist/module/index.js.map +1 -0
  261. package/dist/module/interfaces.d.ts +103 -16
  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 +2 -1
  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 +3 -2
  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 +5 -4
  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 +34 -42
  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 +2 -1
  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 +36 -17
  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 -7524
  409. package/dist/umd/interfaces.d.ts +0 -307
  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 -6487
  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
package/README.md CHANGED
@@ -37,12 +37,24 @@ yarn install && yarn build
37
37
 
38
38
  Here is a quick look at initializing the SDK in different environments:
39
39
 
40
- TypeScript / JavaScript (Module):
40
+ TypeScript / JavaScript (Module) vs. JavaScript (CommonJS) - usually a Node.js environment
41
41
 
42
+ The primary difference between the two environments is the import/require of the sdk-core package, everything else is the same.
43
+
44
+ TS/ESModule
42
45
  ```ts
43
46
  import { Framework } from "@superfluid-finance/sdk-core";
44
47
  import { ethers } from "ethers";
48
+ ```
49
+
50
+ CommonJS/Node.js
51
+ ```js
52
+ const { Framework } = require("@superfluid-finance/sdk-core");
53
+ const { ethers } = require("ethers");
54
+ ```
45
55
 
56
+ ```ts
57
+ // infura provider initialization
46
58
  const provider = new ethers.providers.InfuraProvider(
47
59
  "matic",
48
60
  "<INFURA_API_KEY>"
@@ -60,31 +72,73 @@ const web3jsSf = await Framework.create({
60
72
  networkName: "matic",
61
73
  provider: web3jsProvider
62
74
  });
63
- ```
64
75
 
65
- JavaScript (CommonJS) - usually a Node.js environment:
76
+ // injected web3.js initialization (Hardhat)
77
+ // most likely to be used on backend for testing
78
+ // NOTE: if you're using truffle, you should be able to
79
+ // omit the (global as any) as this should be
80
+ // exposed already (in JS at least)
81
+ const injectedWeb3jsSf = await Framework.create({
82
+ networkName: "custom",
83
+ provider: (global as any).web3,
84
+ dataMode: "WEB3_ONLY",
85
+ resolverAddress: <RESOLVER_ADDRESS>,
86
+ protocolReleaseVersion: "test",
87
+ });
66
88
 
67
- ```js
68
- const { Framework } = require("@superfluid-finance/sdk-core");
69
- const { ethers } = require("ethers");
89
+ // injected hardhat ethers initialization
90
+ // most likely to be used on backend for testing
91
+ import hardhat from "hardhat";
92
+ const injectedHardhatEthersSf = await Framework.create({
93
+ networkName: "custom",
94
+ provider: hardhat.ethers,
95
+ dataMode: "WEB3_ONLY",
96
+ resolverAddress: <RESOLVER_ADDRESS>,
97
+ protocolReleaseVersion: "test",
98
+ })
99
+
100
+ // ethers.js + hardhat provider initialization (in testing environment w/ hardhat-ethers)
101
+ import { ethers } from "hardhat";
102
+ const [deployer] = await ethers.getSigners();
103
+ const ethersProvider = deployer.provider;
104
+ const ethersjsSf = await Framework.create({
105
+ networkName: "custom",
106
+ dataMode: "WEB3_ONLY",
107
+ resolverAddress: <RESOLVER_ADDRESS>,
108
+ protocolReleaseVersion: "test",
109
+ provider: ethersProvider
110
+ });
70
111
 
71
- const provider = new ethers.providers.InfuraProvider(
72
- "matic",
73
- "<INFURA_API_KEY>"
74
- );
75
- const sf = await Framework.create({
112
+ // metamask
113
+ const mmProvider = new ethers.providers.Web3Provider(window.ethereum);
114
+ const mmSf = await Framework.create({
76
115
  networkName: "matic",
77
- provider
116
+ provider: mmProvider
78
117
  });
79
118
 
80
- // web3.js + Hardhat provider initialization
81
- const web3jsProvider = new ethers.providers.Web3Provider(
82
- global.web3.currentProvider
83
- );
84
- const web3jsSf = await Framework.create({
119
+ // web3modal
120
+ const web3ModalRawProvider = await web3Modal.connect();
121
+ const web3ModalProvider = new ethers.providers.Web3Provider(web3ModalRawProvider);
122
+ const web3ModalSf = await Framework.create({
85
123
  networkName: "matic",
86
- provider: web3jsProvider
124
+ provider: web3ModalProvider
125
+ });
126
+
127
+ //bnc-onboard
128
+ const onboard = Onboard({
129
+ dappId: "<API_KEY>",
130
+ networkId: 4,
131
+ subscriptions: {
132
+ wallet: wallet => {
133
+ const web3Provider = new ethers.providers.Web3Provider(wallet.provider);
134
+ (async () => {
135
+ const framework = await Framework.create({ networkName: "matic", provider: web3Provider });
136
+ })();
137
+ }
138
+ }
87
139
  });
140
+ // this is triggered by:
141
+ await onboard.walletSelect();
88
142
  ```
89
143
 
90
144
  > Note: You specify your project type in `package.json` - `"type": "module"` or `"type": "commonjs"`.
@@ -116,12 +170,50 @@ const sf = await Framework.create({
116
170
  provider
117
171
  });
118
172
 
173
+ type Paging = { take: number, skip?: number, lastId?: string };
174
+
119
175
  const pageResult = await sf.query.
120
- listAllSuperTokens({ isListed?: boolean }, { skip: number, take: number });
121
- listIndexes({ indexId?: string, publisher?: string, token?: string }, { skip: number, take: number });
122
- listIndexSubscriptions({ subscriber?: string, approved?: boolean }, { skip: number, take: number });
123
- listStreams({ sender?: string, receiver?: string, token?: string }, { skip: number, take: number });
124
- listUserInteractedSuperTokens({ account?: string, token?: string }, { skip: number, take: number });
176
+ listAllResults(paging: Paging);
177
+
178
+ // The different queries can take different order by properties
179
+ // given the properties that exist on the entity itself.
180
+ listAllSuperTokens({ isListed?: boolean },
181
+ paging: Paging,
182
+ ordering: Ordering<Token_OrderBy>
183
+ );
184
+
185
+ listIndexes({ indexId?: string, publisher?: string, token?: string },
186
+ paging: Paging,
187
+ ordering: Ordering<Index_OrderBy>
188
+ );
189
+
190
+ listIndexSubscriptions({ subscriber?: string, approved?: boolean },
191
+ paging: Paging,
192
+ ordering: Ordering<IndexSubscription_OrderBy>
193
+ );
194
+
195
+ listStreams({ sender?: string, receiver?: string, token?: string },
196
+ paging: Paging,
197
+ ordering: Ordering<Stream_OrderBy>
198
+ );
199
+
200
+ listUserInteractedSuperTokens({ account?: string, token?: string },
201
+ paging: Paging,
202
+ ordering: Ordering<AccountTokenSnapshot_OrderBy>
203
+ );
204
+
205
+ listEvents({ account?: string, timestamp_gt?: number },
206
+ paging: Paging,
207
+ ordering: Ordering<Event_OrderBy>
208
+ );
209
+
210
+ // A subscription function which allows you to subscribe to events via polling.
211
+ on(
212
+ callback: (events: AllEvents[], unsubscribe: () => void) => void,
213
+ ms: number,
214
+ account?: string,
215
+ timeout?: number
216
+ )
125
217
  ```
126
218
 
127
219
  #### Direct Initialization
@@ -130,17 +222,45 @@ If you'd like, you can also initialize the `Query` class as a standalone class l
130
222
 
131
223
  ```ts
132
224
  import { Query } from "@superfluid-finance/sdk-core";
133
- const query = new Query({ customSubgraphQueriesEndpoint: "<A_CUSTOM_ENDPOINT>", dataMode: "SUBGRAPH_ONLY" | "SUBGRAPH_WEB3" | "WEB3_ONLY" });
134
- query.listAllSuperTokens({ isListed?: boolean }, { skip: number, take: number })
135
- //...same queries as above...
225
+ const query = new Query({
226
+ customSubgraphQueriesEndpoint: "<A_CUSTOM_ENDPOINT>",
227
+ dataMode: "SUBGRAPH_ONLY" | "SUBGRAPH_WEB3" | "WEB3_ONLY"
228
+ });
136
229
  ```
137
230
 
138
231
  #### Pagination
139
232
 
140
- All of the pre-defined query functions will accept pagination options: `({ skip: number, take: number })`, if you don't pass anything in, it will use a default of: `{ skip: 0, take: 100 }`.
233
+ All of the pre-defined query functions will accept pagination options: `({ skip: number, take: number })`, if you don't pass anything in, it will use a default of: `{ skip: 0, take: 100 }`. You can also paginate by `lastId`, this allows you to bypass the limitation of the max skip of 5000 entities.
141
234
 
142
235
  > Note: this example uses the `graphql-request` library, but you just need to provide a valid query which is a string.
143
236
 
237
+ #### Ordering
238
+
239
+ You can also pass in an ordering object for the different queries, each query function will accept different ordering properties depending on the properties on the entity. We have different defaults for each so you don't need to actually pass anything in.
240
+
241
+ #### Example Usage
242
+
243
+ ```ts
244
+ const { Framework } = require("@superfluid-finance/sdk-core");
245
+ const { ethers } = require("ethers");
246
+
247
+ const provider = new ethers.providers.InfuraProvider(
248
+ "matic",
249
+ "<INFURA_API_KEY>"
250
+ );
251
+ const sf = await Framework.create({
252
+ networkName: "matic",
253
+ provider
254
+ });
255
+ const results = await sf.query.listAllSuperTokens(
256
+ { isListed: true },
257
+ { skip: 5, take: 150 },
258
+ {
259
+ orderBy: "createdAtBlockNumber",
260
+ orderDirection: "desc"
261
+ });
262
+ ```
263
+
144
264
  ### Creating a Signer
145
265
 
146
266
  In order to execute a transaction on the blockchain, you need to have a signer. That is, you need to have access to an EOA (Externally Owned Account) to trigger any sort of change. You can do this through a contract, but an EOA still has to be the one which triggers the contract to interact with another contract. The signer that is returned will be passed when executing transactions.
@@ -163,11 +283,11 @@ const sf = await Framework.create({
163
283
  provider: web3ModalProvider,
164
284
  });
165
285
 
166
- const web3ModalSigner = sf.createSigner(web3ModalProvider);
286
+ const web3ModalSigner = sf.createSigner({ web3Provider: web3ModalProvider });
167
287
 
168
288
  // MetaMask example
169
289
  const metamaskProvider = new Web3Provider(window.ethereum);
170
- const metaMaskSigner = sf.createSigner(metamaskProvider);
290
+ const metaMaskSigner = sf.createSigner({ web3Provider: metamaskProvider });
171
291
  ```
172
292
 
173
293
  #### Hardhat Signer Example
@@ -212,9 +332,7 @@ const sf = await Framework.create({
212
332
  provider,
213
333
  });
214
334
 
215
- const signer = sf.createSigner({
216
- signer: wallet
217
- });
335
+ const signer = sf.createSigner({ signer: wallet });
218
336
  ```
219
337
 
220
338
  ### Operation
@@ -278,15 +396,88 @@ const cfaV1 = new ConstantFlowAgreementV1({ options: config });
278
396
 
279
397
  #### CFAV1 Functions
280
398
  ```ts
281
- // read
282
- await sf.cfaV1.getFlow({ superToken: string, sender: string, receiver: string, providerOrSigner: ethers.providers.Provider | ethers.Signer });
283
- await sf.cfaV1.getAccountFlowInfo({ superToken: string, account: string, providerOrSigner: ethers.providers.Provider | ethers.Signer });
284
- await sf.cfaV1.getNetFlow({ superToken: string, account: string, providerOrSigner: ethers.providers.Provider | ethers.Signer });
285
-
286
- // write
287
- await sf.cfaV1.createFlow({ sender: string, receiver: string, token: string, flowRate: string, userData?: string });
288
- await sf.cfaV1.updateFlow({ sender: string, receiver: string, token: string, flowRate: string, userData?: string });
289
- await sf.cfaV1.deleteFlow({ sender: string, receiver: string, token: string, userData?: string });
399
+ // Read functions
400
+ await sf.cfaV1.getFlow({
401
+ superToken: string,
402
+ sender: string,
403
+ receiver: string,
404
+ providerOrSigner: ethers.providers.Provider | ethers.Signer
405
+ });
406
+
407
+ await sf.cfaV1.getAccountFlowInfo({
408
+ superToken: string,
409
+ account: string,
410
+ providerOrSigner: ethers.providers.Provider | ethers.Signer
411
+ });
412
+
413
+ await sf.cfaV1.getNetFlow({
414
+ superToken: string,
415
+ account: string,
416
+ providerOrSigner: ethers.providers.Provider | ethers.Signer
417
+ });
418
+
419
+
420
+ // Write operations
421
+ sf.cfaV1.createFlow({
422
+ sender: string,
423
+ receiver: string,
424
+ token: string,
425
+ flowRate: string,
426
+ userData?: string
427
+ });
428
+
429
+ sf.cfaV1.updateFlow({
430
+ sender: string,
431
+ receiver: string,
432
+ token: string,
433
+ flowRate: string,
434
+ userData?: string
435
+ });
436
+
437
+ sf.cfaV1.deleteFlow({
438
+ sender: string,
439
+ receiver: string,
440
+ token: string,
441
+ userData?: string
442
+ });
443
+ ```
444
+
445
+ #### Example Usage
446
+
447
+ ```ts
448
+ import { Framework } from "@superfluid-finance/sdk-core";
449
+ import { ethers } from "ethers";
450
+
451
+ const provider = new ethers.providers.InfuraProvider(
452
+ "matic",
453
+ "<INFURA_API_KEY>"
454
+ );
455
+
456
+ const sf = await Framework.create({
457
+ networkName: "matic",
458
+ provider
459
+ });
460
+
461
+ // Read example
462
+ const flowInfo = await sf.cfaV1.getFlow({
463
+ superToken: "0x...",
464
+ sender: "0x...",
465
+ receiver: "0x...",
466
+ providerOrSigner: provider
467
+ });
468
+ console.log("flowInfo", flowInfo);
469
+
470
+ // Write operation example
471
+ const signer = sf.createSigner({ privateKey: "<TEST_ACCOUNT_PRIVATE_KEY>", provider });
472
+ const createFlowOperation = sf.cfaV1.createFlow({
473
+ sender: "0x...",
474
+ receiver: "0x...",
475
+ token: "0x...",
476
+ flowRate: "1000000000"
477
+ });
478
+ const txnResponse = await createFlowOperation.exec(signer);
479
+ const txnReceipt = await txnResponse.wait();
480
+ // Transaction Complete when code reaches here
290
481
  ```
291
482
 
292
483
  ### InstantDistributionAgreementV1
@@ -310,19 +501,110 @@ const idaV1 = new InstantDistributionAgreementV1({ options: config });
310
501
 
311
502
  #### IDAV1 Functions
312
503
  ```ts
313
- // read
314
- await sf.idaV1.getSubscription({ superToken: string, publisher: string, indexId: string, subscriber: string, providerOrSigner: string });
315
- await sf.idaV1.getIndex({ superToken: string, publisher: string, indexId: string, providerOrSigner: string });
316
-
317
- // write
318
- await sf.idaV1.createIndex({ indexId: string, userData: string });
319
- await sf.idaV1.distribute({ indexId: string, amount: string, userData: string });
320
- await sf.idaV1.updateIndexValue({ indexId: string, indexValue: string, userData: string });
321
- await sf.idaV1.updateSubscriptionUnits({ indexId: string, subscriber: string, units: string, userData: string });
322
- await sf.idaV1.approveSubscription({ indexId: string, subscriber: string, userData: string });
323
- await sf.idaV1.revokeSubscription({ indexId: string, subscriber: string, userData: string });
324
- await sf.idaV1.deleteSubscription({ indexId: string, subscriber: string, publisher: string, userData: string });
325
- await sf.idaV1.claim({ indexId: string, subscriber: string, publisher: string, userData: string });
504
+ // Read functions
505
+ await sf.idaV1.getSubscription({
506
+ superToken: string,
507
+ publisher: string,
508
+ indexId: string,
509
+ subscriber: string,
510
+ providerOrSigner: string
511
+ });
512
+
513
+ await sf.idaV1.getIndex({
514
+ superToken: string,
515
+ publisher: string,
516
+ indexId: string,
517
+ providerOrSigner: string
518
+ });
519
+
520
+
521
+ // Write operations
522
+ sf.idaV1.createIndex({
523
+ indexId: string,
524
+ superToken: string,
525
+ userData?: string
526
+ });
527
+
528
+ sf.idaV1.distribute({
529
+ indexId: string,
530
+ superToken: string,
531
+ amount: string,
532
+ userData?: string
533
+ });
534
+
535
+ sf.idaV1.updateIndexValue({
536
+ indexId: string,
537
+ superToken: string,
538
+ indexValue: string,
539
+ userData?: string
540
+ });
541
+
542
+ sf.idaV1.updateSubscriptionUnits({
543
+ indexId: string,
544
+ superToken: string,
545
+ subscriber: string,
546
+ units: string,
547
+ userData?: string
548
+ });
549
+
550
+ sf.idaV1.approveSubscription({
551
+ indexId: string,
552
+ superToken: string,
553
+ publisher: string,
554
+ userData?: string
555
+ });
556
+
557
+ sf.idaV1.revokeSubscription({
558
+ indexId: string,
559
+ superToken: string,
560
+ publisher: string,
561
+ userData?: string
562
+ });
563
+
564
+ sf.idaV1.deleteSubscription({
565
+ indexId: string,
566
+ superToken: string,
567
+ subscriber: string,
568
+ publisher: string,
569
+ userData?: string
570
+ });
571
+
572
+ sf.idaV1.claim({
573
+ indexId: string,
574
+ superToken: string,
575
+ subscriber: string,
576
+ publisher: string,
577
+ userData?: string
578
+ });
579
+ ```
580
+
581
+ #### Example Usage
582
+
583
+ ```ts
584
+ import { Framework } from "@superfluid-finance/sdk-core";
585
+ import { ethers } from "ethers";
586
+
587
+ const provider = new ethers.providers.InfuraProvider(
588
+ "matic",
589
+ "<INFURA_API_KEY>"
590
+ );
591
+
592
+ const sf = await Framework.create({
593
+ networkName: "matic",
594
+ provider
595
+ });
596
+
597
+ // Read example
598
+ const subscription = await sf.idaV1.getSubscription({ superToken: "0x...", publisher: "0x...", indexId: "1", subscriber: "0x...", providerOrSigner: provider });
599
+ console.log(subscription);
600
+
601
+
602
+ // Write operation example
603
+ const signer = sf.createSigner({ privateKey: "<TEST_ACCOUNT_PRIVATE_KEY>", provider });
604
+ const createIndexOperation = sf.idaV1.createIndex({ indexId: "0", userData: "0x" });
605
+ const txnResponse = await createIndexOperation.exec(signer);
606
+ const txnReceipt = await txnResponse.wait();
607
+ // Transaction Complete when code reaches here
326
608
  ```
327
609
 
328
610
  ### SuperToken
@@ -358,7 +640,6 @@ const provider = new ethers.providers.InfuraProvider(
358
640
  "matic",
359
641
  "<INFURA_API_KEY>"
360
642
  );
361
- let usdcx: SuperToken;
362
643
 
363
644
  const config = {
364
645
  hostAddress: "0x3E14dC1b13c488a8d5D310918780c983bD5982E7",
@@ -367,7 +648,7 @@ const config = {
367
648
  idaV1Address: "0xB0aABBA4B2783A72C52956CDEF62d438ecA2d7a1"
368
649
  };
369
650
 
370
- usdcx = await SuperToken.create({
651
+ const usdcx = await SuperToken.create({
371
652
  address: "0xCAa7349CEA390F89641fe306D93591f87595dc1F",
372
653
  config,
373
654
  networkName: "matic",
@@ -380,32 +661,103 @@ usdcx = await SuperToken.create({
380
661
  ```ts
381
662
  const usdcx = sf.loadToken("0xCAa7349CEA390F89641fe306D93591f87595dc1F");
382
663
 
383
- // SuperToken Read Functions
384
- // ERC20 `Token` function
385
- await usdcx.balanceOf({ account: string, providerOrSigner: ethers.providers.Provider | ethers.Signer }); // Inherited ERC20 function
386
- await usdcx.allowance({ owner: string, spender: string, providerOrSigner: ethers.providers.Provider | ethers.Signer }); // Inherited ERC20 function
387
- await usdcx.totalSupply({ providerOrSigner: ethers.providers.Provider | ethers.Signer }); // Inherited ERC20 function
664
+ // ERC20 `Token`
665
+ // Read functions
666
+ await usdcx.balanceOf({
667
+ account: string,
668
+ providerOrSigner: ethers.providers.Provider | ethers.Signer
669
+ });
670
+
671
+ await usdcx.allowance({
672
+ owner: string,
673
+ spender: string,
674
+ providerOrSigner: ethers.providers.Provider | ethers.Signer
675
+ });
676
+
677
+ await usdcx.name({
678
+ providerOrSigner: ethers.providers.Provider | ethers.Signer
679
+ });
680
+
681
+ await usdcx.symbol({
682
+ providerOrSigner: ethers.providers.Provider | ethers.Signer
683
+ });
684
+
685
+ await usdcx.totalSupply({
686
+ providerOrSigner: ethers.providers.Provider | ethers.Signer
687
+ });
688
+
689
+
690
+ // Write operations
691
+ usdcx.approve({
692
+ recipient: string,
693
+ amount: string
694
+ });
695
+
696
+ usdcx.transfer({
697
+ recipient: string,
698
+ amount: string
699
+ });
700
+
701
+ usdcx.transferFrom({
702
+ sender: string,
703
+ recipient: string,
704
+ amount: string
705
+ });
388
706
 
389
707
  // `SuperToken` only function
390
- await usdcx.realtimeBalanceOf({ account: string, timestamp: string, providerOrSigner: ethers.providers.Provider | ethers.Signer });
708
+ await usdcx.realtimeBalanceOf({
709
+ account: string,
710
+ timestamp: string,
711
+ providerOrSigner: ethers.providers.Provider | ethers.Signer
712
+ });
391
713
 
392
714
  // Write Functions
715
+
393
716
  // All write functions return Promise<Operation>
394
717
 
395
- // SuperToken Write Functions
396
- await usdcx.approve({ recipient: string, amount: string });
397
- await usdcx.downgrade({ amount: string });
398
- await usdcx.transfer({ recipient: string, amount: string });
399
- await usdcx.transferFrom({ sender: string, recipient: string, amount: string });
400
- await usdcx.upgrade({ amount: string });
718
+ // SuperToken Write operations
719
+ usdcx.downgrade({ amount: string });
720
+
721
+ usdcx.upgrade({ amount: string });
401
722
 
402
723
  // SuperToken CFAV1/IDAV1 Functions are the same as the
403
724
  // ConstantFlowAgreementV1/InstantDistributionAgreementV1 class functions
404
725
  // except instead of the sf.cfaV1/idaV1.function() signature, it is token.function()
726
+ // e.g. await usdcx.createIndex({ indexId: "0", userData: "0x" }).exec(signer);
405
727
  // and you don't need to pass in a token as a parameter as it uses the token address
406
728
  // of the instantiated class.
407
729
  ```
408
730
 
731
+ #### Example Usage
732
+
733
+ ```ts
734
+ import { Framework } from "@superfluid-finance/sdk-core";
735
+ import { ethers } from "ethers";
736
+
737
+ const provider = new ethers.providers.InfuraProvider(
738
+ "matic",
739
+ "<INFURA_API_KEY>"
740
+ );
741
+
742
+ const sf = await Framework.create({
743
+ networkName: "matic",
744
+ provider
745
+ });
746
+
747
+ const usdcx = sf.loadToken("0xCAa7349CEA390F89641fe306D93591f87595dc1F");
748
+
749
+ // Read example
750
+ const name = await usdcx.name();
751
+ console.log(name);
752
+
753
+ // Write operation example
754
+ const signer = sf.createSigner({ privateKey: "<TEST_ACCOUNT_PRIVATE_KEY>", provider });
755
+ const transferOperation = usdcx.transfer({ receiver: "0x...", amount: "1000000" });
756
+ const txnResponse = await transferOperation.exec(signer);
757
+ const txnReceipt = await txnResponse.wait();
758
+ // Transaction Complete when code reaches here
759
+ ```
760
+
409
761
  > Note: you can also get the underlying Token object which only has ERC20 token read/write methods-this is useful for things like approving token spend to a SuperToken contract prior to upgrading for example.
410
762
 
411
763
  ```ts
@@ -421,12 +773,12 @@ The `BatchCall` class allows the user to batch multiple supported operations/tra
421
773
 
422
774
  Not all operations are supported by the batch call feature, below is a list of the supported operations:
423
775
 
424
- - ERC20_APPROVE (SuperToken only)
425
- - ERC20_TRANSFER_FROM
426
- - SUPERTOKEN_UPGRADE
427
- - SUPERTOKEN_DOWNGRADE
428
- - SUPERFLUID_CALL_AGREEMENT
429
- - CALL_APP_ACTION
776
+ - `ERC20_APPROVE (SuperToken only)`
777
+ - `ERC20_TRANSFER_FROM`
778
+ - `SUPERTOKEN_UPGRADE`
779
+ - `SUPERTOKEN_DOWNGRADE`
780
+ - `SUPERFLUID_CALL_AGREEMENT`
781
+ - `CALL_APP_ACTION`
430
782
 
431
783
  Most of the token methods are self explanatory, but some additional context for the last two operations is helpful.
432
784
  `SUPERFLUID_CALL_AGREEMENT` refers to all operations related to the CFA or IDA (`createFlow`, `updateIndex`, `distribute`, etc.).
@@ -473,7 +825,32 @@ const batchCall = new BatchCall({
473
825
  #### Usage
474
826
 
475
827
  ```ts
476
- const txn = await batchCall.execute(signer);
828
+ import { Framework } from "@superfluid-finance/sdk-core";
829
+ import { ethers } from "ethers";
830
+
831
+ const provider = new ethers.providers.InfuraProvider(
832
+ "matic",
833
+ "<INFURA_API_KEY>"
834
+ );
835
+
836
+ const sf = await Framework.create({
837
+ networkName: "matic",
838
+ provider
839
+ });
840
+
841
+ // 0xabc is the signer on Rinkeby testnet
842
+ const signer = sf.createSigner({ privateKey: "<TEST_ACCOUNT_PRIVATE_KEY>", provider });
843
+ const daix = await sf.loadSuperToken("0x745861AeD1EEe363b4AaA5F1994Be40b1e05Ff90");
844
+ const fromAddress = "0xabc";
845
+ const paymentAddress = "0xdef";
846
+ const approveOp = daix.approve({ receiver: paymentAddress, amount: "10000" });
847
+ const transferFromOp = daix.transferFrom({
848
+ sender: fromAddress,
849
+ receiver: paymentAddress,
850
+ amount: "10000",
851
+ });
852
+ const batchCall = sf.batchCall([approveOp, transferFromOp]);
853
+ const txn = await batchCall.exec(signer);
477
854
 
478
855
  // creating an operation from a super app function
479
856
  // initialize your super app contract
@@ -483,5 +860,5 @@ const superApp = new ethers.Contract("0x...", <SUPER_APP_ABI>);
483
860
  const superAppTransactionPromise = superApp.populateTransaction.helloWorld("hello world");
484
861
 
485
862
  // create the super app operation you can execute this operation directly or pass it in to a batch call
486
- const superAppOperation = new Operation(superAppOperation, "CALL_APP_ACTION");
863
+ const superAppOperation = new Operation(superAppTransactionPromise, "CALL_APP_ACTION");
487
864
  ```