@superfluid-finance/sdk-redux 0.1.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 (167) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +175 -0
  3. package/build/main/SuperfluidContext.d.ts +31 -0
  4. package/build/main/SuperfluidContext.js +49 -0
  5. package/build/main/createSdkReduxParts.d.ts +23 -0
  6. package/build/main/createSdkReduxParts.js +30 -0
  7. package/build/main/index.d.ts +29 -0
  8. package/build/main/index.js +41 -0
  9. package/build/main/redux-slices/argTypes.d.ts +53 -0
  10. package/build/main/redux-slices/argTypes.js +3 -0
  11. package/build/main/redux-slices/rtk-query/cacheTags/CacheTagTypes.d.ts +15 -0
  12. package/build/main/redux-slices/rtk-query/cacheTags/CacheTagTypes.js +18 -0
  13. package/build/main/redux-slices/rtk-query/cacheTags/eventTags.d.ts +9 -0
  14. package/build/main/redux-slices/rtk-query/cacheTags/eventTags.js +12 -0
  15. package/build/main/redux-slices/rtk-query/cacheTags/indexTags.d.ts +36 -0
  16. package/build/main/redux-slices/rtk-query/cacheTags/indexTags.js +31 -0
  17. package/build/main/redux-slices/rtk-query/cacheTags/invalidateCacheTagsForEvents.d.ts +9 -0
  18. package/build/main/redux-slices/rtk-query/cacheTags/invalidateCacheTagsForEvents.js +148 -0
  19. package/build/main/redux-slices/rtk-query/cacheTags/monitorAddressForNextEventToInvalidateCache.d.ts +10 -0
  20. package/build/main/redux-slices/rtk-query/cacheTags/monitorAddressForNextEventToInvalidateCache.js +21 -0
  21. package/build/main/redux-slices/rtk-query/cacheTags/streamTags.d.ts +35 -0
  22. package/build/main/redux-slices/rtk-query/cacheTags/streamTags.js +30 -0
  23. package/build/main/redux-slices/rtk-query/cacheTags/tokenTags.d.ts +35 -0
  24. package/build/main/redux-slices/rtk-query/cacheTags/tokenTags.js +30 -0
  25. package/build/main/redux-slices/rtk-query/mutations/approveIndexSubscription.d.ts +19 -0
  26. package/build/main/redux-slices/rtk-query/mutations/approveIndexSubscription.js +45 -0
  27. package/build/main/redux-slices/rtk-query/mutations/claimFromIndexSubscription.d.ts +21 -0
  28. package/build/main/redux-slices/rtk-query/mutations/claimFromIndexSubscription.js +46 -0
  29. package/build/main/redux-slices/rtk-query/mutations/createFlow.d.ts +19 -0
  30. package/build/main/redux-slices/rtk-query/mutations/createFlow.js +50 -0
  31. package/build/main/redux-slices/rtk-query/mutations/createIndex.d.ts +17 -0
  32. package/build/main/redux-slices/rtk-query/mutations/createIndex.js +50 -0
  33. package/build/main/redux-slices/rtk-query/mutations/deleteFlow.d.ts +17 -0
  34. package/build/main/redux-slices/rtk-query/mutations/deleteFlow.js +48 -0
  35. package/build/main/redux-slices/rtk-query/mutations/deleteIndexSubscription.d.ts +21 -0
  36. package/build/main/redux-slices/rtk-query/mutations/deleteIndexSubscription.js +46 -0
  37. package/build/main/redux-slices/rtk-query/mutations/distributeToIndex.d.ts +19 -0
  38. package/build/main/redux-slices/rtk-query/mutations/distributeToIndex.js +48 -0
  39. package/build/main/redux-slices/rtk-query/mutations/downgradeFromSuperToken.d.ts +15 -0
  40. package/build/main/redux-slices/rtk-query/mutations/downgradeFromSuperToken.js +46 -0
  41. package/build/main/redux-slices/rtk-query/mutations/monitorForEventsToInvalidateCache.d.ts +16 -0
  42. package/build/main/redux-slices/rtk-query/mutations/monitorForEventsToInvalidateCache.js +40 -0
  43. package/build/main/redux-slices/rtk-query/mutations/revokeIndexSubscription.d.ts +19 -0
  44. package/build/main/redux-slices/rtk-query/mutations/revokeIndexSubscription.js +45 -0
  45. package/build/main/redux-slices/rtk-query/mutations/transferSuperToken.d.ts +17 -0
  46. package/build/main/redux-slices/rtk-query/mutations/transferSuperToken.js +47 -0
  47. package/build/main/redux-slices/rtk-query/mutations/updateFlow.d.ts +19 -0
  48. package/build/main/redux-slices/rtk-query/mutations/updateFlow.js +49 -0
  49. package/build/main/redux-slices/rtk-query/mutations/updateIndexSubscriptionUnits.d.ts +21 -0
  50. package/build/main/redux-slices/rtk-query/mutations/updateIndexSubscriptionUnits.js +46 -0
  51. package/build/main/redux-slices/rtk-query/mutations/upgradeToSuperToken.d.ts +16 -0
  52. package/build/main/redux-slices/rtk-query/mutations/upgradeToSuperToken.js +65 -0
  53. package/build/main/redux-slices/rtk-query/queries/getAllowanceForUpgradeToSuperToken.d.ts +17 -0
  54. package/build/main/redux-slices/rtk-query/queries/getAllowanceForUpgradeToSuperToken.js +43 -0
  55. package/build/main/redux-slices/rtk-query/queries/getIndex.d.ts +17 -0
  56. package/build/main/redux-slices/rtk-query/queries/getIndex.js +43 -0
  57. package/build/main/redux-slices/rtk-query/queries/getIndexSubscription.d.ts +17 -0
  58. package/build/main/redux-slices/rtk-query/queries/getIndexSubscription.js +44 -0
  59. package/build/main/redux-slices/rtk-query/queries/getRealtimeBalance.d.ts +22 -0
  60. package/build/main/redux-slices/rtk-query/queries/getRealtimeBalance.js +75 -0
  61. package/build/main/redux-slices/rtk-query/queries/listEvents.d.ts +15 -0
  62. package/build/main/redux-slices/rtk-query/queries/listEvents.js +59 -0
  63. package/build/main/redux-slices/rtk-query/queries/listIndexSubscriptions.d.ts +15 -0
  64. package/build/main/redux-slices/rtk-query/queries/listIndexSubscriptions.js +41 -0
  65. package/build/main/redux-slices/rtk-query/queries/listIndexes.d.ts +16 -0
  66. package/build/main/redux-slices/rtk-query/queries/listIndexes.js +42 -0
  67. package/build/main/redux-slices/rtk-query/queries/listStreams.d.ts +16 -0
  68. package/build/main/redux-slices/rtk-query/queries/listStreams.js +41 -0
  69. package/build/main/redux-slices/rtk-query/queries/listSuperTokens.d.ts +14 -0
  70. package/build/main/redux-slices/rtk-query/queries/listSuperTokens.js +39 -0
  71. package/build/main/redux-slices/rtk-query/queries/listUserInteractedSuperTokens.d.ts +15 -0
  72. package/build/main/redux-slices/rtk-query/queries/listUserInteractedSuperTokens.js +56 -0
  73. package/build/main/redux-slices/rtk-query/rtkQuerySlice.d.ts +3 -0
  74. package/build/main/redux-slices/rtk-query/rtkQuerySlice.js +53 -0
  75. package/build/main/redux-slices/rtk-query/rtkQuerySliceBaseQuery.d.ts +21 -0
  76. package/build/main/redux-slices/rtk-query/rtkQuerySliceBaseQuery.js +14 -0
  77. package/build/main/redux-slices/transactions/registerNewTransaction.d.ts +5 -0
  78. package/build/main/redux-slices/transactions/registerNewTransaction.js +33 -0
  79. package/build/main/redux-slices/transactions/trackTransaction.d.ts +12 -0
  80. package/build/main/redux-slices/transactions/trackTransaction.js +66 -0
  81. package/build/main/redux-slices/transactions/transactionSlice.d.ts +36 -0
  82. package/build/main/redux-slices/transactions/transactionSlice.js +19 -0
  83. package/build/main/utils.d.ts +25 -0
  84. package/build/main/utils.js +34 -0
  85. package/build/module/SuperfluidContext.d.ts +31 -0
  86. package/build/module/SuperfluidContext.js +46 -0
  87. package/build/module/createSdkReduxParts.d.ts +23 -0
  88. package/build/module/createSdkReduxParts.js +26 -0
  89. package/build/module/index.d.ts +29 -0
  90. package/build/module/index.js +29 -0
  91. package/build/module/redux-slices/argTypes.d.ts +53 -0
  92. package/build/module/redux-slices/argTypes.js +2 -0
  93. package/build/module/redux-slices/rtk-query/cacheTags/CacheTagTypes.d.ts +15 -0
  94. package/build/module/redux-slices/rtk-query/cacheTags/CacheTagTypes.js +14 -0
  95. package/build/module/redux-slices/rtk-query/cacheTags/eventTags.d.ts +9 -0
  96. package/build/module/redux-slices/rtk-query/cacheTags/eventTags.js +8 -0
  97. package/build/module/redux-slices/rtk-query/cacheTags/indexTags.d.ts +36 -0
  98. package/build/module/redux-slices/rtk-query/cacheTags/indexTags.js +26 -0
  99. package/build/module/redux-slices/rtk-query/cacheTags/invalidateCacheTagsForEvents.d.ts +9 -0
  100. package/build/module/redux-slices/rtk-query/cacheTags/invalidateCacheTagsForEvents.js +144 -0
  101. package/build/module/redux-slices/rtk-query/cacheTags/monitorAddressForNextEventToInvalidateCache.d.ts +10 -0
  102. package/build/module/redux-slices/rtk-query/cacheTags/monitorAddressForNextEventToInvalidateCache.js +17 -0
  103. package/build/module/redux-slices/rtk-query/cacheTags/streamTags.d.ts +35 -0
  104. package/build/module/redux-slices/rtk-query/cacheTags/streamTags.js +25 -0
  105. package/build/module/redux-slices/rtk-query/cacheTags/tokenTags.d.ts +35 -0
  106. package/build/module/redux-slices/rtk-query/cacheTags/tokenTags.js +25 -0
  107. package/build/module/redux-slices/rtk-query/mutations/approveIndexSubscription.d.ts +19 -0
  108. package/build/module/redux-slices/rtk-query/mutations/approveIndexSubscription.js +43 -0
  109. package/build/module/redux-slices/rtk-query/mutations/claimFromIndexSubscription.d.ts +21 -0
  110. package/build/module/redux-slices/rtk-query/mutations/claimFromIndexSubscription.js +44 -0
  111. package/build/module/redux-slices/rtk-query/mutations/createFlow.d.ts +19 -0
  112. package/build/module/redux-slices/rtk-query/mutations/createFlow.js +48 -0
  113. package/build/module/redux-slices/rtk-query/mutations/createIndex.d.ts +17 -0
  114. package/build/module/redux-slices/rtk-query/mutations/createIndex.js +48 -0
  115. package/build/module/redux-slices/rtk-query/mutations/deleteFlow.d.ts +17 -0
  116. package/build/module/redux-slices/rtk-query/mutations/deleteFlow.js +46 -0
  117. package/build/module/redux-slices/rtk-query/mutations/deleteIndexSubscription.d.ts +21 -0
  118. package/build/module/redux-slices/rtk-query/mutations/deleteIndexSubscription.js +44 -0
  119. package/build/module/redux-slices/rtk-query/mutations/distributeToIndex.d.ts +19 -0
  120. package/build/module/redux-slices/rtk-query/mutations/distributeToIndex.js +46 -0
  121. package/build/module/redux-slices/rtk-query/mutations/downgradeFromSuperToken.d.ts +15 -0
  122. package/build/module/redux-slices/rtk-query/mutations/downgradeFromSuperToken.js +44 -0
  123. package/build/module/redux-slices/rtk-query/mutations/monitorForEventsToInvalidateCache.d.ts +16 -0
  124. package/build/module/redux-slices/rtk-query/mutations/monitorForEventsToInvalidateCache.js +38 -0
  125. package/build/module/redux-slices/rtk-query/mutations/revokeIndexSubscription.d.ts +19 -0
  126. package/build/module/redux-slices/rtk-query/mutations/revokeIndexSubscription.js +43 -0
  127. package/build/module/redux-slices/rtk-query/mutations/transferSuperToken.d.ts +17 -0
  128. package/build/module/redux-slices/rtk-query/mutations/transferSuperToken.js +45 -0
  129. package/build/module/redux-slices/rtk-query/mutations/updateFlow.d.ts +19 -0
  130. package/build/module/redux-slices/rtk-query/mutations/updateFlow.js +47 -0
  131. package/build/module/redux-slices/rtk-query/mutations/updateIndexSubscriptionUnits.d.ts +21 -0
  132. package/build/module/redux-slices/rtk-query/mutations/updateIndexSubscriptionUnits.js +44 -0
  133. package/build/module/redux-slices/rtk-query/mutations/upgradeToSuperToken.d.ts +16 -0
  134. package/build/module/redux-slices/rtk-query/mutations/upgradeToSuperToken.js +63 -0
  135. package/build/module/redux-slices/rtk-query/queries/getAllowanceForUpgradeToSuperToken.d.ts +17 -0
  136. package/build/module/redux-slices/rtk-query/queries/getAllowanceForUpgradeToSuperToken.js +41 -0
  137. package/build/module/redux-slices/rtk-query/queries/getIndex.d.ts +17 -0
  138. package/build/module/redux-slices/rtk-query/queries/getIndex.js +41 -0
  139. package/build/module/redux-slices/rtk-query/queries/getIndexSubscription.d.ts +17 -0
  140. package/build/module/redux-slices/rtk-query/queries/getIndexSubscription.js +42 -0
  141. package/build/module/redux-slices/rtk-query/queries/getRealtimeBalance.d.ts +22 -0
  142. package/build/module/redux-slices/rtk-query/queries/getRealtimeBalance.js +73 -0
  143. package/build/module/redux-slices/rtk-query/queries/listEvents.d.ts +15 -0
  144. package/build/module/redux-slices/rtk-query/queries/listEvents.js +57 -0
  145. package/build/module/redux-slices/rtk-query/queries/listIndexSubscriptions.d.ts +15 -0
  146. package/build/module/redux-slices/rtk-query/queries/listIndexSubscriptions.js +39 -0
  147. package/build/module/redux-slices/rtk-query/queries/listIndexes.d.ts +16 -0
  148. package/build/module/redux-slices/rtk-query/queries/listIndexes.js +40 -0
  149. package/build/module/redux-slices/rtk-query/queries/listStreams.d.ts +16 -0
  150. package/build/module/redux-slices/rtk-query/queries/listStreams.js +39 -0
  151. package/build/module/redux-slices/rtk-query/queries/listSuperTokens.d.ts +14 -0
  152. package/build/module/redux-slices/rtk-query/queries/listSuperTokens.js +37 -0
  153. package/build/module/redux-slices/rtk-query/queries/listUserInteractedSuperTokens.d.ts +15 -0
  154. package/build/module/redux-slices/rtk-query/queries/listUserInteractedSuperTokens.js +54 -0
  155. package/build/module/redux-slices/rtk-query/rtkQuerySlice.d.ts +3 -0
  156. package/build/module/redux-slices/rtk-query/rtkQuerySlice.js +47 -0
  157. package/build/module/redux-slices/rtk-query/rtkQuerySliceBaseQuery.d.ts +21 -0
  158. package/build/module/redux-slices/rtk-query/rtkQuerySliceBaseQuery.js +10 -0
  159. package/build/module/redux-slices/transactions/registerNewTransaction.d.ts +5 -0
  160. package/build/module/redux-slices/transactions/registerNewTransaction.js +29 -0
  161. package/build/module/redux-slices/transactions/trackTransaction.d.ts +12 -0
  162. package/build/module/redux-slices/transactions/trackTransaction.js +62 -0
  163. package/build/module/redux-slices/transactions/transactionSlice.d.ts +36 -0
  164. package/build/module/redux-slices/transactions/transactionSlice.js +19 -0
  165. package/build/module/utils.d.ts +25 -0
  166. package/build/module/utils.js +29 -0
  167. package/package.json +87 -0
package/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright © 2021 Superfluid Finance Ltd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,175 @@
1
+ <h1 align="center">sdk-redux</h1>
2
+ <div align="center">
3
+ <img width="300" padding="0 0 10px" alt="Superfluid logo" src="/sf-logo.png" />
4
+ <p>
5
+ <a href="https://www.npmjs.com/package/@superfluid-finance/sdk-redux" target="_blank">
6
+ <img alt="Version" src="https://img.shields.io/npm/v/@superfluid-finance/sdk-redux.svg">
7
+ </a>
8
+ <a href="#" target="_blank">
9
+ <img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" />
10
+ </a>
11
+ <a href="https://twitter.com/Superfluid_HQ/" target="blank">
12
+ <img alt="Twitter: Superfluid_HQ" src="https://img.shields.io/twitter/follow/Superfluid_HQ.svg?style=social" />
13
+ </a>
14
+ </p>
15
+ </div>
16
+
17
+ ### 🏠 [Homepage](https://superfluid.finance)
18
+
19
+ ### ✨ [Superfluid App](https://app.superfluid.finance/)
20
+
21
+ ### 📖 [Docs](https://docs.superfluid.finance)
22
+
23
+ # Introduction
24
+ SDK-Redux is an application framework for building front-end applications that interact with the Superfluid Protocol.
25
+
26
+ More specifically, SDK-Redux is a wrapper library around `@superfluid-fincance/sdk-core` which adds state management to Superfluid related queries and operations.
27
+ Under the hood, SDK-Redux leverages popular Redux libraries Redux Toolkit & RTK Query.
28
+
29
+ ## Important Disclaimer
30
+ SDK-Redux is in early active development and can have breaking releases without warning and without consideration for semantic versioning.
31
+
32
+ # Features
33
+ * Tracking loading state in order to show UI spinners
34
+ * Avoiding duplicate requests for the same data
35
+ * Managing cache lifetimes as the user interacts with the UI
36
+ * Tracking blockchain transactions produced by user interactions
37
+
38
+ # Notable Used Technologies
39
+ * TypeScript
40
+ * Redux
41
+ * Redux Toolkit
42
+ * RTK Query
43
+ * Ethers
44
+
45
+ # Requirements
46
+ * Redux store & Redux Toolkit
47
+ * React* (The SDK-Redux generates React Hooks which are recommended but not strictly necessary to use. The SDK-Redux is UI-framework agnostic but we currently have example only for React)
48
+
49
+ # Getting Started
50
+ ## Plugging Into Redux Store
51
+ Requirements:
52
+
53
+ A brand-new scaffolded Redux store configuration looks something like this:
54
+ ```ts
55
+ import { configureStore, ThunkAction, Action } from '@reduxjs/toolkit';
56
+
57
+ export const store = configureStore({
58
+ reducer: {
59
+ },
60
+ });
61
+
62
+ export type AppDispatch = typeof store.dispatch;
63
+ export type RootState = ReturnType<typeof store.getState>;
64
+ export type AppThunk<ReturnType = void> = ThunkAction<
65
+ ReturnType,
66
+ RootState,
67
+ unknown,
68
+ Action<string>
69
+ >;
70
+ ```
71
+
72
+ We need to plug in the Superfluid SDK-Redux parts.
73
+
74
+ Import this function: `import { createSdkReduxParts } from "@superfluid-finance/sdk-redux";`
75
+
76
+ Then create the pieces:
77
+ ```ts
78
+ const {
79
+ superfluidContext,
80
+ apiSlice,
81
+ transactionSlice,
82
+ } = createSdkReduxParts();
83
+ ```
84
+
85
+ Plug in the reducer slices:
86
+ ```ts
87
+ export const store = configureStore({
88
+ reducer: {
89
+ //
90
+ [apiSlice.reducerPath]: apiSlice.reducer,
91
+ [transactionSlice.reducerPath]: transactionSlice.reducer,
92
+ //
93
+ },
94
+ });
95
+ ```
96
+
97
+ Add the middleware:
98
+ ```ts
99
+ export const store = configureStore({
100
+ reducer: {
101
+ [apiSlice.reducerPath]: apiSlice.reducer,
102
+ [transactionSlice.reducerPath]: transactionSlice.reducer,
103
+ },
104
+ //
105
+ middleware: (getDefaultMiddleware) =>
106
+ getDefaultMiddleware().concat(apiSlice.middleware)
107
+ //
108
+ });
109
+ ```
110
+
111
+ Export the Superfluid Context:
112
+ ```ts
113
+ export { superfluidContext };
114
+ ```
115
+
116
+ Somewhere in your code, give instructions to the `superfluidContext` to locate `Framework` and `Signer`:
117
+ ```ts
118
+ superfluidContext
119
+ .setFramework(
120
+ chainId,
121
+ superfluidFramework
122
+ )
123
+ .setSigner(
124
+ chainId,
125
+ ethersWeb3Provider.getSigner()
126
+ );
127
+ ```
128
+
129
+ That should be it! You should now be able to dispatch messages to Superfluid reducers & use the React hooks.
130
+
131
+ ## Using Queries (i.e. "read" operations)
132
+ Read about RTK-Query queries here: https://redux-toolkit.js.org/rtk-query/usage/queries
133
+
134
+ Example using React Hook:
135
+ ```ts
136
+ const {
137
+ data: pagedStreams,
138
+ isUninitialized,
139
+ isFetching,
140
+ isLoading,
141
+ isError,
142
+ error,
143
+ refetch,
144
+ } = useListStreamsQuery({
145
+ chainId: queryChainId,
146
+ senderAddress,
147
+ receiverAddress,
148
+ superTokenAddress,
149
+ skip: (page - 1) * pageSize,
150
+ take: pageSize,
151
+ }, {
152
+ pollingInterval: 5000 // Not necessary to use but nice-to-have additional option by RTK-Query.
153
+ });
154
+ ```
155
+
156
+ ## Using Mutations (i.e. "write" operations)
157
+ Read about RTK-Query queries here: https://redux-toolkit.js.org/rtk-query/usage/mutations
158
+
159
+ Example using React Hook:
160
+ ```ts
161
+ const tx = await createFlow({
162
+ senderAddress: signerAddress,
163
+ receiverAddress: receiver,
164
+ flowRateWei: flowRate,
165
+ chainId,
166
+ superTokenAddress: superToken,
167
+ waitForConfirmation,
168
+ }).unwrap();
169
+ ```
170
+
171
+ ### Transaction Tracking
172
+ All mutations trigger tracking for transaction progress (stored in `transactionSlice`) and transaction monitoring for re-orgs (all cached data is re-fetched in case of a re-org).
173
+
174
+ # Examples
175
+ Check out the extensive demo here: `examples/sdk-redux-react-typescript`.
@@ -0,0 +1,31 @@
1
+ import { Framework } from '@superfluid-finance/sdk-core';
2
+ import { Signer } from 'ethers';
3
+ /**
4
+ * Context is a way for SDK-Redux reducers to access the current SDK-Core Framework instance
5
+ * and the current active signer for transaction broadcasting.
6
+ *
7
+ * The context object is a way to do "dependency injection" or "service location", if you will.
8
+ */
9
+ export interface SuperfluidContext {
10
+ getFramework: (chainId: number) => Promise<Framework>;
11
+ getSigner: (chainId: number) => Promise<Signer>;
12
+ /**
13
+ *
14
+ * @param chainId
15
+ * @param framework
16
+ * @returns Returns itself for fluent API.
17
+ */
18
+ setFramework: (chainId: number, framework: (() => Promise<Framework>) | Framework) => SuperfluidContext;
19
+ /**
20
+ *
21
+ * @param chainId
22
+ * @param signer
23
+ * @returns Returns itself for fluent API.
24
+ */
25
+ setSigner: (chainId: number, signer: (() => Promise<Signer>) | Signer) => SuperfluidContext;
26
+ getFrameworkAndSigner: (chainId: number) => Promise<[framework: Framework, signer: Signer]>;
27
+ }
28
+ /**
29
+ * A preinitialized instance of a {@link SuperfluidContext}.
30
+ */
31
+ export declare const preinitializedSuperfluidContext: SuperfluidContext;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.preinitializedSuperfluidContext = void 0;
4
+ const sdk_core_1 = require("@superfluid-finance/sdk-core");
5
+ const ethers_1 = require("ethers");
6
+ const frameworks = new Map();
7
+ const signers = new Map();
8
+ /**
9
+ * A preinitialized instance of a {@link SuperfluidContext}.
10
+ */
11
+ exports.preinitializedSuperfluidContext = {
12
+ getFramework: (chainId) => {
13
+ const frameworkGetter = frameworks.get(chainId);
14
+ if (!frameworkGetter)
15
+ throw Error(`Don't know how to get Superfluid Framework. :( Please set up a *framework* source for chain [${chainId}].`);
16
+ return frameworkGetter();
17
+ },
18
+ getSigner: (chainId) => {
19
+ const signerGetter = signers.get(chainId);
20
+ if (!signerGetter)
21
+ throw Error(`Don't know how to get a signer. :( Please set up a *signer* source for chain [${chainId}].`);
22
+ return signerGetter();
23
+ },
24
+ setFramework: (chainId, framework) => {
25
+ if (framework instanceof sdk_core_1.Framework) {
26
+ frameworks.set(chainId, () => Promise.resolve(framework));
27
+ }
28
+ else {
29
+ frameworks.set(chainId, framework);
30
+ }
31
+ return exports.preinitializedSuperfluidContext;
32
+ },
33
+ setSigner: (chainId, signer) => {
34
+ if (signer instanceof ethers_1.Signer) {
35
+ signers.set(chainId, () => Promise.resolve(signer));
36
+ }
37
+ else {
38
+ signers.set(chainId, signer);
39
+ }
40
+ return exports.preinitializedSuperfluidContext;
41
+ },
42
+ getFrameworkAndSigner: async (chainId) => {
43
+ return await Promise.all([
44
+ exports.preinitializedSuperfluidContext.getFramework(chainId),
45
+ exports.preinitializedSuperfluidContext.getSigner(chainId),
46
+ ]);
47
+ },
48
+ };
49
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU3VwZXJmbHVpZENvbnRleHQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvU3VwZXJmbHVpZENvbnRleHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsMkRBQXVEO0FBQ3ZELG1DQUE4QjtBQUU5QixNQUFNLFVBQVUsR0FBRyxJQUFJLEdBQUcsRUFBb0MsQ0FBQztBQUMvRCxNQUFNLE9BQU8sR0FBRyxJQUFJLEdBQUcsRUFBaUMsQ0FBQztBQW9DekQ7O0dBRUc7QUFDVSxRQUFBLCtCQUErQixHQUFzQjtJQUM5RCxZQUFZLEVBQUUsQ0FBQyxPQUFlLEVBQXNCLEVBQUU7UUFDbEQsTUFBTSxlQUFlLEdBQUcsVUFBVSxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUNoRCxJQUFJLENBQUMsZUFBZTtZQUNoQixNQUFNLEtBQUssQ0FDUCxnR0FBZ0csT0FBTyxJQUFJLENBQzlHLENBQUM7UUFDTixPQUFPLGVBQWUsRUFBRSxDQUFDO0lBQzdCLENBQUM7SUFDRCxTQUFTLEVBQUUsQ0FBQyxPQUFlLEVBQW1CLEVBQUU7UUFDNUMsTUFBTSxZQUFZLEdBQUcsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUMxQyxJQUFJLENBQUMsWUFBWTtZQUNiLE1BQU0sS0FBSyxDQUNQLGlGQUFpRixPQUFPLElBQUksQ0FDL0YsQ0FBQztRQUNOLE9BQU8sWUFBWSxFQUFFLENBQUM7SUFDMUIsQ0FBQztJQUNELFlBQVksRUFBRSxDQUNWLE9BQWUsRUFDZixTQUFpRCxFQUNuRCxFQUFFO1FBQ0EsSUFBSSxTQUFTLFlBQVksb0JBQVMsRUFBRTtZQUNoQyxVQUFVLENBQUMsR0FBRyxDQUFDLE9BQU8sRUFBRSxHQUFHLEVBQUUsQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUM7U0FDN0Q7YUFBTTtZQUNILFVBQVUsQ0FBQyxHQUFHLENBQUMsT0FBTyxFQUFFLFNBQVMsQ0FBQyxDQUFDO1NBQ3RDO1FBQ0QsT0FBTyx1Q0FBK0IsQ0FBQztJQUMzQyxDQUFDO0lBQ0QsU0FBUyxFQUFFLENBQUMsT0FBZSxFQUFFLE1BQXdDLEVBQUUsRUFBRTtRQUNyRSxJQUFJLE1BQU0sWUFBWSxlQUFNLEVBQUU7WUFDMUIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLEVBQUUsR0FBRyxFQUFFLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDO1NBQ3ZEO2FBQU07WUFDSCxPQUFPLENBQUMsR0FBRyxDQUFDLE9BQU8sRUFBRSxNQUFNLENBQUMsQ0FBQztTQUNoQztRQUNELE9BQU8sdUNBQStCLENBQUM7SUFDM0MsQ0FBQztJQUNELHFCQUFxQixFQUFFLEtBQUssRUFDeEIsT0FBZSxFQUNnQyxFQUFFO1FBQ2pELE9BQU8sTUFBTSxPQUFPLENBQUMsR0FBRyxDQUFDO1lBQ3JCLHVDQUErQixDQUFDLFlBQVksQ0FBQyxPQUFPLENBQUM7WUFDckQsdUNBQStCLENBQUMsU0FBUyxDQUFDLE9BQU8sQ0FBQztTQUNyRCxDQUFDLENBQUM7SUFDUCxDQUFDO0NBQ0osQ0FBQyJ9
@@ -0,0 +1,23 @@
1
+ import { SuperfluidContext } from './SuperfluidContext';
2
+ import { SuperfluidApiReduxSliceType } from './redux-slices/rtk-query/rtkQuerySlice';
3
+ import { SuperfluidTransactionReduxSlice, transactionSlice } from './redux-slices/transactions/transactionSlice';
4
+ export declare let initializedSuperfluidContext: SuperfluidContext;
5
+ /**
6
+ * First initialization point of SDK-Redux.
7
+ * Creates the necessary parts to set up redux store and dependency injection for SDk-Redux.
8
+ * @param superfluidContext Optional user-defined instance of {@link SuperfluidContext}.
9
+ */
10
+ export declare const createSdkReduxParts: (superfluidContext?: SuperfluidContext | undefined) => {
11
+ /**
12
+ * Returns the initialized instance of {@link SuperfluidContext}. When user passes in their own instance then that is returned.
13
+ */
14
+ superfluidContext: SuperfluidContext;
15
+ /**
16
+ * Instance of {@link SuperfluidApiReduxSliceType} to plug into the redux store.
17
+ */
18
+ apiSlice: SuperfluidApiReduxSliceType;
19
+ /**
20
+ * Instance of {@link SuperfluidTransactionReduxSlice} to plug into the Redux store.
21
+ */
22
+ transactionSlice: SuperfluidTransactionReduxSlice;
23
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSdkReduxParts = exports.initializedSuperfluidContext = void 0;
4
+ const SuperfluidContext_1 = require("./SuperfluidContext");
5
+ const rtkQuerySlice_1 = require("./redux-slices/rtk-query/rtkQuerySlice");
6
+ const transactionSlice_1 = require("./redux-slices/transactions/transactionSlice");
7
+ exports.initializedSuperfluidContext = null;
8
+ /**
9
+ * First initialization point of SDK-Redux.
10
+ * Creates the necessary parts to set up redux store and dependency injection for SDk-Redux.
11
+ * @param superfluidContext Optional user-defined instance of {@link SuperfluidContext}.
12
+ */
13
+ const createSdkReduxParts = (superfluidContext) => {
14
+ if (exports.initializedSuperfluidContext) {
15
+ throw Error("You shouldn't create the slice multiple times.");
16
+ }
17
+ if (superfluidContext) {
18
+ exports.initializedSuperfluidContext = superfluidContext;
19
+ }
20
+ else {
21
+ exports.initializedSuperfluidContext = SuperfluidContext_1.preinitializedSuperfluidContext;
22
+ }
23
+ return {
24
+ superfluidContext: exports.initializedSuperfluidContext,
25
+ apiSlice: rtkQuerySlice_1.rtkQuerySlice,
26
+ transactionSlice: transactionSlice_1.transactionSlice,
27
+ };
28
+ };
29
+ exports.createSdkReduxParts = createSdkReduxParts;
30
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlU2RrUmVkdXhQYXJ0cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jcmVhdGVTZGtSZWR1eFBhcnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLDJEQUc2QjtBQUM3QiwwRUFHZ0Q7QUFDaEQsbUZBR3NEO0FBRTNDLFFBQUEsNEJBQTRCLEdBQXNCLElBQUssQ0FBQztBQUVuRTs7OztHQUlHO0FBQ0ksTUFBTSxtQkFBbUIsR0FBRyxDQUMvQixpQkFBcUMsRUFjdkMsRUFBRTtJQUNBLElBQUksb0NBQTRCLEVBQUU7UUFDOUIsTUFBTSxLQUFLLENBQUMsZ0RBQWdELENBQUMsQ0FBQztLQUNqRTtJQUVELElBQUksaUJBQWlCLEVBQUU7UUFDbkIsb0NBQTRCLEdBQUcsaUJBQWlCLENBQUM7S0FDcEQ7U0FBTTtRQUNILG9DQUE0QixHQUFHLG1EQUErQixDQUFDO0tBQ2xFO0lBRUQsT0FBTztRQUNILGlCQUFpQixFQUFFLG9DQUE0QjtRQUMvQyxRQUFRLEVBQUUsNkJBQWE7UUFDdkIsZ0JBQWdCLEVBQUUsbUNBQWdCO0tBQ3JDLENBQUM7QUFDTixDQUFDLENBQUM7QUEvQlcsUUFBQSxtQkFBbUIsdUJBK0I5QiJ9
@@ -0,0 +1,29 @@
1
+ export * from '@superfluid-finance/sdk-core';
2
+ export * from './createSdkReduxParts';
3
+ export * from './SuperfluidContext';
4
+ export * from './redux-slices/rtk-query/queries/listStreams';
5
+ export * from './redux-slices/rtk-query/queries/listEvents';
6
+ export * from './redux-slices/rtk-query/queries/listSuperTokens';
7
+ export * from './redux-slices/rtk-query/queries/listIndexes';
8
+ export * from './redux-slices/rtk-query/queries/listIndexSubscriptions';
9
+ export * from './redux-slices/rtk-query/queries/listUserInteractedSuperTokens';
10
+ export * from './redux-slices/rtk-query/queries/getRealtimeBalance';
11
+ export * from './redux-slices/rtk-query/queries/getAllowanceForUpgradeToSuperToken';
12
+ export * from './redux-slices/rtk-query/mutations/createFlow';
13
+ export * from './redux-slices/rtk-query/mutations/updateFlow';
14
+ export * from './redux-slices/rtk-query/mutations/deleteFlow';
15
+ export * from './redux-slices/rtk-query/mutations/transferSuperToken';
16
+ export * from './redux-slices/rtk-query/mutations/upgradeToSuperToken';
17
+ export * from './redux-slices/rtk-query/mutations/downgradeFromSuperToken';
18
+ export * from './redux-slices/rtk-query/mutations/approveIndexSubscription';
19
+ export * from './redux-slices/rtk-query/mutations/updateIndexSubscriptionUnits';
20
+ export * from './redux-slices/rtk-query/mutations/createIndex';
21
+ export * from './redux-slices/rtk-query/mutations/distributeToIndex';
22
+ export * from './redux-slices/rtk-query/mutations/claimFromIndexSubscription';
23
+ export * from './redux-slices/rtk-query/mutations/deleteIndexSubscription';
24
+ export * from './redux-slices/rtk-query/mutations/revokeIndexSubscription';
25
+ export * from './redux-slices/rtk-query/mutations/monitorForEventsToInvalidateCache';
26
+ export { ValidationError, PossibleErrors, } from './redux-slices/rtk-query/rtkQuerySliceBaseQuery';
27
+ export * from './redux-slices/transactions/transactionSlice';
28
+ export * from './redux-slices/transactions/trackTransaction';
29
+ export { SuperfluidApiReduxSliceType } from './redux-slices/rtk-query/rtkQuerySlice';
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ // Export everything from SDK-Core.
14
+ __exportStar(require("@superfluid-finance/sdk-core"), exports);
15
+ __exportStar(require("./createSdkReduxParts"), exports);
16
+ __exportStar(require("./SuperfluidContext"), exports);
17
+ __exportStar(require("./redux-slices/rtk-query/queries/listStreams"), exports);
18
+ __exportStar(require("./redux-slices/rtk-query/queries/listEvents"), exports);
19
+ __exportStar(require("./redux-slices/rtk-query/queries/listSuperTokens"), exports);
20
+ __exportStar(require("./redux-slices/rtk-query/queries/listIndexes"), exports);
21
+ __exportStar(require("./redux-slices/rtk-query/queries/listIndexSubscriptions"), exports);
22
+ __exportStar(require("./redux-slices/rtk-query/queries/listUserInteractedSuperTokens"), exports);
23
+ __exportStar(require("./redux-slices/rtk-query/queries/getRealtimeBalance"), exports);
24
+ __exportStar(require("./redux-slices/rtk-query/queries/getAllowanceForUpgradeToSuperToken"), exports);
25
+ __exportStar(require("./redux-slices/rtk-query/mutations/createFlow"), exports);
26
+ __exportStar(require("./redux-slices/rtk-query/mutations/updateFlow"), exports);
27
+ __exportStar(require("./redux-slices/rtk-query/mutations/deleteFlow"), exports);
28
+ __exportStar(require("./redux-slices/rtk-query/mutations/transferSuperToken"), exports);
29
+ __exportStar(require("./redux-slices/rtk-query/mutations/upgradeToSuperToken"), exports);
30
+ __exportStar(require("./redux-slices/rtk-query/mutations/downgradeFromSuperToken"), exports);
31
+ __exportStar(require("./redux-slices/rtk-query/mutations/approveIndexSubscription"), exports);
32
+ __exportStar(require("./redux-slices/rtk-query/mutations/updateIndexSubscriptionUnits"), exports);
33
+ __exportStar(require("./redux-slices/rtk-query/mutations/createIndex"), exports);
34
+ __exportStar(require("./redux-slices/rtk-query/mutations/distributeToIndex"), exports);
35
+ __exportStar(require("./redux-slices/rtk-query/mutations/claimFromIndexSubscription"), exports);
36
+ __exportStar(require("./redux-slices/rtk-query/mutations/deleteIndexSubscription"), exports);
37
+ __exportStar(require("./redux-slices/rtk-query/mutations/revokeIndexSubscription"), exports);
38
+ __exportStar(require("./redux-slices/rtk-query/mutations/monitorForEventsToInvalidateCache"), exports);
39
+ __exportStar(require("./redux-slices/transactions/transactionSlice"), exports);
40
+ __exportStar(require("./redux-slices/transactions/trackTransaction"), exports);
41
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0FBQUEsbUNBQW1DO0FBQ25DLCtEQUE2QztBQUU3Qyx3REFBc0M7QUFDdEMsc0RBQW9DO0FBRXBDLCtFQUE2RDtBQUM3RCw4RUFBNEQ7QUFDNUQsbUZBQWlFO0FBQ2pFLCtFQUE2RDtBQUM3RCwwRkFBd0U7QUFDeEUsaUdBQStFO0FBQy9FLHNGQUFvRTtBQUNwRSxzR0FBb0Y7QUFDcEYsZ0ZBQThEO0FBQzlELGdGQUE4RDtBQUM5RCxnRkFBOEQ7QUFDOUQsd0ZBQXNFO0FBQ3RFLHlGQUF1RTtBQUN2RSw2RkFBMkU7QUFDM0UsOEZBQTRFO0FBQzVFLGtHQUFnRjtBQUNoRixpRkFBK0Q7QUFDL0QsdUZBQXFFO0FBQ3JFLGdHQUE4RTtBQUM5RSw2RkFBMkU7QUFDM0UsNkZBQTJFO0FBQzNFLHVHQUFxRjtBQU1yRiwrRUFBNkQ7QUFDN0QsK0VBQTZEIn0=
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Information about the transaction to locate it.
3
+ */
4
+ export declare type TransactionInfo = {
5
+ /** The transaction's network chain ID. */
6
+ chainId: number;
7
+ /** The transaction hash. */
8
+ hash: string;
9
+ };
10
+ /**
11
+ *
12
+ */
13
+ export declare type QueryArg = {
14
+ /** Queried network's chain ID. */
15
+ chainId: number;
16
+ };
17
+ /**
18
+ *
19
+ */
20
+ export declare type PaginatedQueryArg = QueryArg & {
21
+ /** How many entries to skip. */
22
+ skip: number;
23
+ /** How many entries to return. */
24
+ take: number;
25
+ };
26
+ /**
27
+ * TEST
28
+ */
29
+ export declare type SuperTokenMutationArg = {
30
+ /** The network's chain ID where transactions will be broadcast. */
31
+ chainId: number;
32
+ /** SuperToken the mutation will affect. */
33
+ superTokenAddress: string;
34
+ /**
35
+ * Whether to wait for one confirmation to the transaction or not.
36
+ *
37
+ * If set to `true` then the mutation will be blocking, i.e. the react hook / redux thunk will return control flow after first confirmation for the transaction broadcast.
38
+ * If set to `false` then the mutation will not be blocking, i.e. the react hook / redux thunk will not return.
39
+ */
40
+ waitForConfirmation: boolean | NothingBoolean;
41
+ };
42
+ /**
43
+ * Input for strings that is ignored.
44
+ */
45
+ export declare type NothingString = '' | undefined;
46
+ /**
47
+ * Input for numbers that is ignored.
48
+ */
49
+ export declare type NothingNumber = undefined;
50
+ /**
51
+ * Input for booleans that is ignored.
52
+ */
53
+ export declare type NothingBoolean = undefined;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXJnVHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcmVkdXgtc2xpY2VzL2FyZ1R5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
@@ -0,0 +1,15 @@
1
+ /**
2
+ * All possible cache tag types.
3
+ * @private
4
+ * @category Cache Tags
5
+ */
6
+ export declare type CacheTagTypes = 'Event' | 'Index' | 'Stream' | 'Token';
7
+ /**
8
+ * Create a cache tag for RTK-Query.
9
+ * @private
10
+ * @category Cache Tags
11
+ */
12
+ export declare const createTag: (type: CacheTagTypes, ...keys: (string | number)[]) => {
13
+ type: CacheTagTypes;
14
+ id: string;
15
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createTag = void 0;
4
+ /**
5
+ * Create a cache tag for RTK-Query.
6
+ * @private
7
+ * @category Cache Tags
8
+ */
9
+ const createTag = (type, ...keys) => ({
10
+ type: type,
11
+ id: keys.join('_').toLowerCase(),
12
+ });
13
+ exports.createTag = createTag;
14
+ // Order of address priorities if all present:
15
+ // 1. SuperToken Address
16
+ // 2. Publisher / Sender / From Address
17
+ // 3. Subscriber / Receiver / To Address
18
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ2FjaGVUYWdUeXBlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9yZWR1eC1zbGljZXMvcnRrLXF1ZXJ5L2NhY2hlVGFncy9DYWNoZVRhZ1R5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQVFBOzs7O0dBSUc7QUFDSSxNQUFNLFNBQVMsR0FBRyxDQUNyQixJQUFtQixFQUNuQixHQUFHLElBQXlCLEVBQzlCLEVBQUUsQ0FBQyxDQUFDO0lBQ0YsSUFBSSxFQUFFLElBQUk7SUFDVixFQUFFLEVBQUUsSUFBSSxDQUFDLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQyxXQUFXLEVBQUU7Q0FDbkMsQ0FBQyxDQUFDO0FBTlUsUUFBQSxTQUFTLGFBTW5CO0FBRUgsOENBQThDO0FBQzlDLHdCQUF3QjtBQUN4Qix1Q0FBdUM7QUFDdkMsd0NBQXdDIn0=
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The simplest cache tag.
3
+ * @private
4
+ * @category Cache Tags
5
+ */
6
+ export declare const createEventTag: (chainId: number) => {
7
+ type: import("./CacheTagTypes").CacheTagTypes;
8
+ id: string;
9
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createEventTag = void 0;
4
+ const CacheTagTypes_1 = require("./CacheTagTypes");
5
+ /**
6
+ * The simplest cache tag.
7
+ * @private
8
+ * @category Cache Tags
9
+ */
10
+ const createEventTag = (chainId) => (0, CacheTagTypes_1.createTag)('Event', chainId);
11
+ exports.createEventTag = createEventTag;
12
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXZlbnRUYWdzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vc3JjL3JlZHV4LXNsaWNlcy9ydGstcXVlcnkvY2FjaGVUYWdzL2V2ZW50VGFncy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxtREFBMEM7QUFFMUM7Ozs7R0FJRztBQUNJLE1BQU0sY0FBYyxHQUFHLENBQUMsT0FBZSxFQUFFLEVBQUUsQ0FBQyxJQUFBLHlCQUFTLEVBQUMsT0FBTyxFQUFFLE9BQU8sQ0FBQyxDQUFDO0FBQWxFLFFBQUEsY0FBYyxrQkFBb0QifQ==
@@ -0,0 +1,36 @@
1
+ import { NothingString } from '../../argTypes';
2
+ /**
3
+ * NOTE:
4
+ * Always order addresses in the following priority (if all addresses present):
5
+ * * 1. SuperToken Address
6
+ * * 2. Publisher / Sender / From Address
7
+ * * 3. Subscriber / Receiver / To Address
8
+ * If an address is not present then the rest of the addresses move up in priority.
9
+ * @private
10
+ * @category Cache Tags
11
+ */
12
+ declare type IndexTagArg = {
13
+ chainId: number;
14
+ address1: string | NothingString;
15
+ address2: string | NothingString;
16
+ address3: string | NothingString;
17
+ indexId: string | NothingString;
18
+ };
19
+ /**
20
+ * Creates all possible index cache tag combinations.
21
+ * @private
22
+ * @category Cache Tags
23
+ */
24
+ export declare const createIndexTags: ({ chainId, address1, address2, address3, indexId, }: IndexTagArg) => {
25
+ type: import("./CacheTagTypes").CacheTagTypes;
26
+ id: string;
27
+ }[];
28
+ /**
29
+ * @private
30
+ * @category Cache Tags
31
+ */
32
+ export declare const getMostSpecificIndexTag: (arg: IndexTagArg) => {
33
+ type: import("./CacheTagTypes").CacheTagTypes;
34
+ id: string;
35
+ };
36
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMostSpecificIndexTag = exports.createIndexTags = void 0;
4
+ const utils_1 = require("../../../utils");
5
+ const CacheTagTypes_1 = require("./CacheTagTypes");
6
+ /**
7
+ * Creates all possible index cache tag combinations.
8
+ * @private
9
+ * @category Cache Tags
10
+ */
11
+ const createIndexTags = ({ chainId, address1, address2, address3, indexId, }) => [
12
+ indexTag(chainId),
13
+ ...(0, utils_1.insertIf)(address1, indexTag(chainId, address1)),
14
+ ...(0, utils_1.insertIf)(address2, indexTag(chainId, address2)),
15
+ ...(0, utils_1.insertIf)(address3, indexTag(chainId, address3)),
16
+ ...(0, utils_1.insertIf)(address1 && address2, indexTag(chainId, address1, address2)),
17
+ ...(0, utils_1.insertIf)(address1 && address3, indexTag(chainId, address1, address3)),
18
+ ...(0, utils_1.insertIf)(address1 && address2 && address3, indexTag(chainId, address1, address2, address3)),
19
+ ...(0, utils_1.insertIf)(address1 && address2 && address3 && indexId, indexTag(chainId, address1, address2, address3, indexId)),
20
+ ];
21
+ exports.createIndexTags = createIndexTags;
22
+ /**
23
+ * @private
24
+ * @category Cache Tags
25
+ */
26
+ const getMostSpecificIndexTag = (arg) => {
27
+ return (0, exports.createIndexTags)(arg).reverse()[0];
28
+ };
29
+ exports.getMostSpecificIndexTag = getMostSpecificIndexTag;
30
+ const indexTag = (chainId, ...keys) => (0, CacheTagTypes_1.createTag)('Index', chainId, ...keys);
31
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXhUYWdzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vc3JjL3JlZHV4LXNsaWNlcy9ydGstcXVlcnkvY2FjaGVUYWdzL2luZGV4VGFncy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwwQ0FBd0M7QUFHeEMsbURBQTBDO0FBb0IxQzs7OztHQUlHO0FBQ0ksTUFBTSxlQUFlLEdBQUcsQ0FBQyxFQUM1QixPQUFPLEVBQ1AsUUFBUSxFQUNSLFFBQVEsRUFDUixRQUFRLEVBQ1IsT0FBTyxHQUNHLEVBQUUsRUFBRSxDQUFDO0lBQ2YsUUFBUSxDQUFDLE9BQU8sQ0FBQztJQUNqQixHQUFHLElBQUEsZ0JBQVEsRUFBQyxRQUFRLEVBQUUsUUFBUSxDQUFDLE9BQU8sRUFBRSxRQUFTLENBQUMsQ0FBQztJQUNuRCxHQUFHLElBQUEsZ0JBQVEsRUFBQyxRQUFRLEVBQUUsUUFBUSxDQUFDLE9BQU8sRUFBRSxRQUFTLENBQUMsQ0FBQztJQUNuRCxHQUFHLElBQUEsZ0JBQVEsRUFBQyxRQUFRLEVBQUUsUUFBUSxDQUFDLE9BQU8sRUFBRSxRQUFTLENBQUMsQ0FBQztJQUNuRCxHQUFHLElBQUEsZ0JBQVEsRUFBQyxRQUFRLElBQUksUUFBUSxFQUFFLFFBQVEsQ0FBQyxPQUFPLEVBQUUsUUFBUyxFQUFFLFFBQVMsQ0FBQyxDQUFDO0lBQzFFLEdBQUcsSUFBQSxnQkFBUSxFQUFDLFFBQVEsSUFBSSxRQUFRLEVBQUUsUUFBUSxDQUFDLE9BQU8sRUFBRSxRQUFTLEVBQUUsUUFBUyxDQUFDLENBQUM7SUFDMUUsR0FBRyxJQUFBLGdCQUFRLEVBQ1AsUUFBUSxJQUFJLFFBQVEsSUFBSSxRQUFRLEVBQ2hDLFFBQVEsQ0FBQyxPQUFPLEVBQUUsUUFBUyxFQUFFLFFBQVMsRUFBRSxRQUFTLENBQUMsQ0FDckQ7SUFDRCxHQUFHLElBQUEsZ0JBQVEsRUFDUCxRQUFRLElBQUksUUFBUSxJQUFJLFFBQVEsSUFBSSxPQUFPLEVBQzNDLFFBQVEsQ0FBQyxPQUFPLEVBQUUsUUFBUyxFQUFFLFFBQVMsRUFBRSxRQUFTLEVBQUUsT0FBUSxDQUFDLENBQy9EO0NBQ0osQ0FBQztBQXJCVyxRQUFBLGVBQWUsbUJBcUIxQjtBQUVGOzs7R0FHRztBQUNJLE1BQU0sdUJBQXVCLEdBQUcsQ0FBQyxHQUFnQixFQUFFLEVBQUU7SUFDeEQsT0FBTyxJQUFBLHVCQUFlLEVBQUMsR0FBRyxDQUFDLENBQUMsT0FBTyxFQUFFLENBQUMsQ0FBQyxDQUFDLENBQUM7QUFDN0MsQ0FBQyxDQUFDO0FBRlcsUUFBQSx1QkFBdUIsMkJBRWxDO0FBRUYsTUFBTSxRQUFRLEdBQUcsQ0FBQyxPQUFlLEVBQUUsR0FBRyxJQUFjLEVBQUUsRUFBRSxDQUNwRCxJQUFBLHlCQUFTLEVBQUMsT0FBTyxFQUFFLE9BQU8sRUFBRSxHQUFHLElBQUksQ0FBQyxDQUFDIn0=
@@ -0,0 +1,9 @@
1
+ import { AnyAction, ThunkDispatch } from '@reduxjs/toolkit';
2
+ import { AllEvents } from '@superfluid-finance/sdk-core';
3
+ /**
4
+ * Based on event type, invalidate all possible relevant cache tags.
5
+ * Cache tag invalidation will trigger re-querying of data.
6
+ * @private
7
+ * @category Cache Tags
8
+ */
9
+ export declare const invalidateCacheTagsForEvents: (chainId: number, events: AllEvents[], dispatch: ThunkDispatch<any, any, AnyAction>) => void;