@aurigami/sdk 1.11.0-beta2 → 1.11.0-beta3
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/dist/helpers/helpers.d.ts +7 -0
- package/dist/sdk.cjs.development.js +19 -1
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +19 -2
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers/helpers.ts +15 -0
- package/src/interactors/PlyGame.ts +3 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { TypedEvent } from '@aurigami/contracts/typechain/common';
|
|
1
2
|
import { Provider } from '@ethersproject/abstract-provider';
|
|
2
3
|
import BigNumber from 'bignumber.js';
|
|
4
|
+
import { Result } from 'ethers/lib/utils';
|
|
3
5
|
import { Address } from '../types';
|
|
4
6
|
export declare function assert(condition: boolean, message?: string): void;
|
|
5
7
|
export declare function formatObject(object: Object): string;
|
|
@@ -29,3 +31,8 @@ export declare function getBlocksTimestamp(provider: Provider, blockNumbers: num
|
|
|
29
31
|
*/
|
|
30
32
|
export declare function getBlockBeforeTimestamp(provider: Provider, timestamp: number): Promise<number>;
|
|
31
33
|
export declare function devLog(message?: any, ...optionalParams: any[]): void;
|
|
34
|
+
/**
|
|
35
|
+
* Sorts (in place) an array of Events by blocknumber.
|
|
36
|
+
* This method mutates the array and returns a reference to the same array.
|
|
37
|
+
**/
|
|
38
|
+
export declare function sortEvents<T extends Result>(events: TypedEvent<T>[]): TypedEvent<T>[];
|
|
@@ -1490,6 +1490,20 @@ function devLog(message) {
|
|
|
1490
1490
|
(_console = console).log.apply(_console, ['[DEV LOG]', message].concat(optionalParams));
|
|
1491
1491
|
}
|
|
1492
1492
|
}
|
|
1493
|
+
/**
|
|
1494
|
+
* Sorts (in place) an array of Events by blocknumber.
|
|
1495
|
+
* This method mutates the array and returns a reference to the same array.
|
|
1496
|
+
**/
|
|
1497
|
+
|
|
1498
|
+
function sortEvents(events) {
|
|
1499
|
+
return events.sort(function (a, b) {
|
|
1500
|
+
if (a.blockNumber == b.blockNumber) {
|
|
1501
|
+
return a.logIndex - b.logIndex;
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
return a.blockNumber - b.blockNumber;
|
|
1505
|
+
});
|
|
1506
|
+
}
|
|
1493
1507
|
|
|
1494
1508
|
var BlockchainEntityRead = function BlockchainEntityRead(networkConnection) {
|
|
1495
1509
|
this._networkConnection = networkConnection;
|
|
@@ -2598,6 +2612,7 @@ var helpers = {
|
|
|
2598
2612
|
getBlocksTimestamp: getBlocksTimestamp,
|
|
2599
2613
|
getBlockBeforeTimestamp: getBlockBeforeTimestamp,
|
|
2600
2614
|
devLog: devLog,
|
|
2615
|
+
sortEvents: sortEvents,
|
|
2601
2616
|
fetchPriceFromCoingeckoAPI: fetchPriceFromCoingeckoAPI,
|
|
2602
2617
|
fetchPriceFromCoingecko: fetchPriceFromCoingecko,
|
|
2603
2618
|
fetchLPPositions: fetchLPPositions,
|
|
@@ -4732,11 +4747,13 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4732
4747
|
|
|
4733
4748
|
case 8:
|
|
4734
4749
|
events = _context2.sent;
|
|
4750
|
+
// Sort descending by block number
|
|
4751
|
+
sortEvents(events).reverse();
|
|
4735
4752
|
return _context2.abrupt("return", this.attachTimestamp(events.map(function (event) {
|
|
4736
4753
|
return _this2.parseBetMakeEvent(event);
|
|
4737
4754
|
})));
|
|
4738
4755
|
|
|
4739
|
-
case
|
|
4756
|
+
case 11:
|
|
4740
4757
|
case "end":
|
|
4741
4758
|
return _context2.stop();
|
|
4742
4759
|
}
|
|
@@ -5943,6 +5960,7 @@ exports.networkAddresses = networkAddresses;
|
|
|
5943
5960
|
exports.queryGraphQL = queryGraphQL;
|
|
5944
5961
|
exports.referralRewardDummy1 = referralRewardDummy1;
|
|
5945
5962
|
exports.referralRewardDummy2 = referralRewardDummy2;
|
|
5963
|
+
exports.sortEvents = sortEvents;
|
|
5946
5964
|
exports.symbolRecords = symbolRecords;
|
|
5947
5965
|
exports.validateAndParseAddress = validateAndParseAddress;
|
|
5948
5966
|
exports.valuateToken = valuateToken;
|