@@ -84,6 +84,23 @@ func RpcMakePoolStruct(poolKey string) RpcPool {
84
84
}
85
85
86
86
rpcPool.TickBitmaps = pool.tickBitmaps
87
+
88
+ _positions := pool.positions
89
+ rpcPositions := []RpcPosition{}
90
+ for posKey, posInfo := range _positions {
91
+ owner, tickLower, tickUpper := posKeyDivide(posKey)
92
+
93
+ rpcPositions = append(rpcPositions, RpcPosition{
94
+ Owner: owner,
95
+ TickLower: tickLower,
96
+ TickUpper: tickUpper,
97
+ Liquidity: posInfo.liquidity,
98
+ Token0Owed: posInfo.tokensOwed0,
99
+ Token1Owed: posInfo.tokensOwed1,
100
+ })
101
+ }
102
+ rpcPool.Positions = rpcPositions
103
+
87
104
return rpcPool
88
105
}
89
106
@@ -134,6 +151,22 @@ func RpcMakePool(poolKey string) string {
134
151
135
152
rpcPool.TickBitmaps = pool.tickBitmaps
136
153
154
+ _positions := pool.positions
155
+ rpcPositions := []RpcPosition{}
156
+ for posKey, posInfo := range _positions {
157
+ owner, tickLower, tickUpper := posKeyDivide(posKey)
158
+
159
+ rpcPositions = append(rpcPositions, RpcPosition{
160
+ Owner: owner,
161
+ TickLower: tickLower,
162
+ TickUpper: tickUpper,
163
+ Liquidity: posInfo.liquidity,
164
+ Token0Owed: posInfo.tokensOwed0,
165
+ Token1Owed: posInfo.tokensOwed1,
166
+ })
167
+ }
168
+ rpcPool.Positions = rpcPositions
169
+
137
170
rr, err := json.Marshal(rpcPool)
138
171
if err != nil {
139
172
panic(ufmt.Sprintf("[POOL] getter_api.gno__RpcMakePool() || %v", err))
@@ -142,6 +175,7 @@ func RpcMakePool(poolKey string) string {
142
175
return string(rr)
143
176
}
144
177
178
+ // TYPEs
145
179
type RpcPool struct {
146
180
PoolPath string `json:"pool_path"`
147
181
@@ -180,6 +214,8 @@ type RpcPool struct {
180
214
181
215
// tickBitmaps is a mapping from tick index to tick bitmap
182
216
TickBitmaps TickBitmaps `json:"tick_bitmaps"`
217
+
218
+ Positions []RpcPosition
183
219
}
184
220
185
221
type RpcTicks map[int32]RpcTickInfo // tick => RpcTickInfo
@@ -197,3 +233,15 @@ type RpcTickInfo struct {
197
233
198
234
Initialized bool `json:"initialized"`
199
235
}
236
+
237
+ type RpcPosition struct {
238
+ Owner string `json:"owner"`
239
+
240
+ TickLower bigint `json:"tick_lower"`
241
+ TickUpper bigint `json:"tick_upper"`
242
+
243
+ Liquidity bigint `json:"liquidity"`
244
+
245
+ Token0Owed bigint `json:"token0_owed"`
246
+ Token1Owed bigint `json:"token1_owed"`
247
+ }
0 commit comments