@inco/lightning-preview 0.7.9 → 0.7.10
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.
- package/package.json +1 -1
- package/src/Preview.Lib.sol +13 -13
package/package.json
CHANGED
package/src/Preview.Lib.sol
CHANGED
|
@@ -21,7 +21,7 @@ library ePreview {
|
|
|
21
21
|
* @param handle EList handle to read contrainer type from.
|
|
22
22
|
* @return ret Type of each element in the list.
|
|
23
23
|
*/
|
|
24
|
-
function listTypeOf(elist handle)
|
|
24
|
+
function listTypeOf(elist handle) internal pure returns (ETypes ret) {
|
|
25
25
|
return ETypes(uint8(uint256(elist.unwrap(handle)) >> 16));
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -30,7 +30,7 @@ library ePreview {
|
|
|
30
30
|
* @param listType Type of each element in the list. This can not be changed
|
|
31
31
|
* @return ret A new elist handle
|
|
32
32
|
*/
|
|
33
|
-
function newEList(ETypes listType)
|
|
33
|
+
function newEList(ETypes listType) internal returns (elist ret) {
|
|
34
34
|
return incoPreview.newEList(new bytes32[](0), listType);
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -150,7 +150,7 @@ library ePreview {
|
|
|
150
150
|
* @return ret Returns a handle for the element of type ETypes.Bool.
|
|
151
151
|
*/
|
|
152
152
|
|
|
153
|
-
function getEbool(elist a, uint16 i)
|
|
153
|
+
function getEbool(elist a, uint16 i) internal returns (ebool ret) {
|
|
154
154
|
return ebool.wrap(incoPreview.listGet(a, i));
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
@@ -160,7 +160,7 @@ library ePreview {
|
|
|
160
160
|
* @return ret Returns a handle for the element of type ETypes.Uint256.
|
|
161
161
|
*/
|
|
162
162
|
|
|
163
|
-
function getEuint256(elist a, uint16 i)
|
|
163
|
+
function getEuint256(elist a, uint16 i) internal returns (euint256 ret) {
|
|
164
164
|
return euint256.wrap(incoPreview.listGet(a, i));
|
|
165
165
|
}
|
|
166
166
|
|
|
@@ -216,7 +216,7 @@ library ePreview {
|
|
|
216
216
|
* @param b EList handle to be appended
|
|
217
217
|
* @return ret A new elist handle containing elements from both A and B with length of len(list1)+len(list2).
|
|
218
218
|
*/
|
|
219
|
-
function concat(elist a, elist b)
|
|
219
|
+
function concat(elist a, elist b) internal returns (elist ret) {
|
|
220
220
|
return incoPreview.listConcat(a, b);
|
|
221
221
|
}
|
|
222
222
|
|
|
@@ -227,7 +227,7 @@ library ePreview {
|
|
|
227
227
|
* @param end End index of the slice, in plaintext. End is exclusive and must be greater or equal start and within the bounds of the list length.
|
|
228
228
|
* @return ret A new sliced list with a new length of “end-start”.
|
|
229
229
|
*/
|
|
230
|
-
function slice(elist a, uint16 start, uint16 end)
|
|
230
|
+
function slice(elist a, uint16 start, uint16 end) internal returns (elist ret) {
|
|
231
231
|
require(end >= start, InvalidRange(start, end));
|
|
232
232
|
require(end <= length(a), SliceOutOfRange(start, end, length(a)));
|
|
233
233
|
require(start < length(a), SliceOutOfRange(start, end, length(a)));
|
|
@@ -272,7 +272,7 @@ library ePreview {
|
|
|
272
272
|
* @param end End of the range, exclusive. Must be greater or equal start.
|
|
273
273
|
* @return ret A new elist handle containing a range of unique elements with the length of “end-start”
|
|
274
274
|
*/
|
|
275
|
-
function range(uint16 start, uint16 end)
|
|
275
|
+
function range(uint16 start, uint16 end) internal returns (elist ret) {
|
|
276
276
|
return incoPreview.listRange(start, end);
|
|
277
277
|
}
|
|
278
278
|
|
|
@@ -281,8 +281,8 @@ library ePreview {
|
|
|
281
281
|
* @param a elist handle to be shuffled
|
|
282
282
|
* @return ret A new elist handle with elements shuffled where each element is equally likely to be in any position in the new list.
|
|
283
283
|
*/
|
|
284
|
-
function shuffle(elist a)
|
|
285
|
-
return incoPreview.listShuffle(a);
|
|
284
|
+
function shuffle(elist a) internal returns (elist ret) {
|
|
285
|
+
return incoPreview.listShuffle{value: inco.getFee()}(a);
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
/**
|
|
@@ -291,8 +291,8 @@ library ePreview {
|
|
|
291
291
|
* @param end End of the range, exclusive. Must be greater or equal start.
|
|
292
292
|
* @return ret A new elist handle containing a range of unique elements with the length of “end-start” in a random order.
|
|
293
293
|
*/
|
|
294
|
-
function shuffledRange(uint16 start, uint16 end)
|
|
295
|
-
return incoPreview.listShuffle(incoPreview.listRange(start, end));
|
|
294
|
+
function shuffledRange(uint16 start, uint16 end) internal returns (elist ret) {
|
|
295
|
+
return incoPreview.listShuffle{value: inco.getFee()}(incoPreview.listRange(start, end));
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
/**
|
|
@@ -300,7 +300,7 @@ library ePreview {
|
|
|
300
300
|
* @param a Elist handle to be reversed
|
|
301
301
|
* @return ret A new elist handle with elements in reverse order
|
|
302
302
|
*/
|
|
303
|
-
function reverse(elist a)
|
|
303
|
+
function reverse(elist a) internal returns (elist ret) {
|
|
304
304
|
return incoPreview.listReverse(a);
|
|
305
305
|
}
|
|
306
306
|
|
|
@@ -309,7 +309,7 @@ library ePreview {
|
|
|
309
309
|
* @param a EList handle to read the length from
|
|
310
310
|
* @return len The length of the list in plaintext
|
|
311
311
|
*/
|
|
312
|
-
function length(elist a)
|
|
312
|
+
function length(elist a) internal pure returns (uint16 len) {
|
|
313
313
|
return incoPreview.lengthOf(elist.unwrap(a));
|
|
314
314
|
}
|
|
315
315
|
|