@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/sdk.esm.js CHANGED
@@ -1485,6 +1485,20 @@ function devLog(message) {
1485
1485
  (_console = console).log.apply(_console, ['[DEV LOG]', message].concat(optionalParams));
1486
1486
  }
1487
1487
  }
1488
+ /**
1489
+ * Sorts (in place) an array of Events by blocknumber.
1490
+ * This method mutates the array and returns a reference to the same array.
1491
+ **/
1492
+
1493
+ function sortEvents(events) {
1494
+ return events.sort(function (a, b) {
1495
+ if (a.blockNumber == b.blockNumber) {
1496
+ return a.logIndex - b.logIndex;
1497
+ }
1498
+
1499
+ return a.blockNumber - b.blockNumber;
1500
+ });
1501
+ }
1488
1502
 
1489
1503
  var BlockchainEntityRead = function BlockchainEntityRead(networkConnection) {
1490
1504
  this._networkConnection = networkConnection;
@@ -2593,6 +2607,7 @@ var helpers = {
2593
2607
  getBlocksTimestamp: getBlocksTimestamp,
2594
2608
  getBlockBeforeTimestamp: getBlockBeforeTimestamp,
2595
2609
  devLog: devLog,
2610
+ sortEvents: sortEvents,
2596
2611
  fetchPriceFromCoingeckoAPI: fetchPriceFromCoingeckoAPI,
2597
2612
  fetchPriceFromCoingecko: fetchPriceFromCoingecko,
2598
2613
  fetchLPPositions: fetchLPPositions,
@@ -4731,11 +4746,13 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4731
4746
 
4732
4747
  case 8:
4733
4748
  events = _context2.sent;
4749
+ // Sort descending by block number
4750
+ sortEvents(events).reverse();
4734
4751
  return _context2.abrupt("return", this.attachTimestamp(events.map(function (event) {
4735
4752
  return _this2.parseBetMakeEvent(event);
4736
4753
  })));
4737
4754
 
4738
- case 10:
4755
+ case 11:
4739
4756
  case "end":
4740
4757
  return _context2.stop();
4741
4758
  }
@@ -5842,5 +5859,5 @@ BigNumber.config({
5842
5859
  DECIMAL_PLACES: 50
5843
5860
  });
5844
5861
 
5845
- export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, DEPOSIT_ONLY_TOKENS, ETHAddress, HARDCODE_PRICE_TOKENS, INF, MarketAction, MiscRead, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, PlyGame, PlyGameRead, PlyGameReadWrite, REFERRAL_CAMPAIGNS, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, index as abis, assert, calcLMRewardApr, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getApi, getBlockBeforeTimestamp, getBlockTimestamp, getBlocksTimestamp, getBlocksTimestampViaRPC, getCurrentTimestamp, getDecimal, getPaginatedApi, getQuery, getSymbol, getUnderlying, isSameAddress, networkAddresses, queryGraphQL, referralRewardDummy1, referralRewardDummy2, symbolRecords, validateAndParseAddress, valuateToken };
5862
+ export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, DEPOSIT_ONLY_TOKENS, ETHAddress, HARDCODE_PRICE_TOKENS, INF, MarketAction, MiscRead, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, PlyGame, PlyGameRead, PlyGameReadWrite, REFERRAL_CAMPAIGNS, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, index as abis, assert, calcLMRewardApr, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getApi, getBlockBeforeTimestamp, getBlockTimestamp, getBlocksTimestamp, getBlocksTimestampViaRPC, getCurrentTimestamp, getDecimal, getPaginatedApi, getQuery, getSymbol, getUnderlying, isSameAddress, networkAddresses, queryGraphQL, referralRewardDummy1, referralRewardDummy2, sortEvents, symbolRecords, validateAndParseAddress, valuateToken };
5846
5863
  //# sourceMappingURL=sdk.esm.js.map