@aurigami/sdk 1.11.0-beta1 → 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/interactors/PlyGame.d.ts +5 -1
- package/dist/sdk.cjs.development.js +80 -19
- 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 +80 -20
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/index.d.ts +5 -0
- package/package.json +1 -1
- package/src/helpers/helpers.ts +15 -0
- package/src/interactors/PlyGame.ts +23 -2
- package/src/types/index.ts +6 -0
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
|
|
4755
|
+
case 11:
|
|
4739
4756
|
case "end":
|
|
4740
4757
|
return _context2.stop();
|
|
4741
4758
|
}
|
|
@@ -4877,6 +4894,49 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4877
4894
|
}
|
|
4878
4895
|
|
|
4879
4896
|
return getPlyGameResultsInTransaction;
|
|
4897
|
+
}()
|
|
4898
|
+
/**
|
|
4899
|
+
* Top 100 users by amount of PULP unlocked
|
|
4900
|
+
*/
|
|
4901
|
+
;
|
|
4902
|
+
|
|
4903
|
+
_proto.leaderboard =
|
|
4904
|
+
/*#__PURE__*/
|
|
4905
|
+
function () {
|
|
4906
|
+
var _leaderboard = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
|
|
4907
|
+
var _this4 = this;
|
|
4908
|
+
|
|
4909
|
+
var result;
|
|
4910
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
4911
|
+
while (1) {
|
|
4912
|
+
switch (_context7.prev = _context7.next) {
|
|
4913
|
+
case 0:
|
|
4914
|
+
_context7.next = 2;
|
|
4915
|
+
return getPaginatedApi('/plygame/leaderboard');
|
|
4916
|
+
|
|
4917
|
+
case 2:
|
|
4918
|
+
result = _context7.sent;
|
|
4919
|
+
return _context7.abrupt("return", result.items.map(function (item, i) {
|
|
4920
|
+
return {
|
|
4921
|
+
player: item.user,
|
|
4922
|
+
unlockedPulpAmount: new TokenAmount(_this4.pulpToken, item.unlockedAmount),
|
|
4923
|
+
gamesPlayed: item.count
|
|
4924
|
+
};
|
|
4925
|
+
}));
|
|
4926
|
+
|
|
4927
|
+
case 4:
|
|
4928
|
+
case "end":
|
|
4929
|
+
return _context7.stop();
|
|
4930
|
+
}
|
|
4931
|
+
}
|
|
4932
|
+
}, _callee7);
|
|
4933
|
+
}));
|
|
4934
|
+
|
|
4935
|
+
function leaderboard() {
|
|
4936
|
+
return _leaderboard.apply(this, arguments);
|
|
4937
|
+
}
|
|
4938
|
+
|
|
4939
|
+
return leaderboard;
|
|
4880
4940
|
}();
|
|
4881
4941
|
|
|
4882
4942
|
return PlyGameRead;
|
|
@@ -4896,19 +4956,19 @@ var PlyGameReadWrite = /*#__PURE__*/function (_PlyGameRead) {
|
|
|
4896
4956
|
_proto2.makeBetMultiple =
|
|
4897
4957
|
/*#__PURE__*/
|
|
4898
4958
|
function () {
|
|
4899
|
-
var _makeBetMultiple = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4900
|
-
return runtime_1.wrap(function
|
|
4959
|
+
var _makeBetMultiple = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(amount, times) {
|
|
4960
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
4901
4961
|
while (1) {
|
|
4902
|
-
switch (
|
|
4962
|
+
switch (_context8.prev = _context8.next) {
|
|
4903
4963
|
case 0:
|
|
4904
|
-
return
|
|
4964
|
+
return _context8.abrupt("return", this.env.plygame.connect(this._networkConnection.signer).makeBetMultiple(amount.rawAmount(), times));
|
|
4905
4965
|
|
|
4906
4966
|
case 1:
|
|
4907
4967
|
case "end":
|
|
4908
|
-
return
|
|
4968
|
+
return _context8.stop();
|
|
4909
4969
|
}
|
|
4910
4970
|
}
|
|
4911
|
-
},
|
|
4971
|
+
}, _callee8, this);
|
|
4912
4972
|
}));
|
|
4913
4973
|
|
|
4914
4974
|
function makeBetMultiple(_x5, _x6) {
|
|
@@ -4925,19 +4985,19 @@ var PlyGameReadWrite = /*#__PURE__*/function (_PlyGameRead) {
|
|
|
4925
4985
|
_proto2.makeBetOnce =
|
|
4926
4986
|
/*#__PURE__*/
|
|
4927
4987
|
function () {
|
|
4928
|
-
var _makeBetOnce = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4929
|
-
return runtime_1.wrap(function
|
|
4988
|
+
var _makeBetOnce = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(amount) {
|
|
4989
|
+
return runtime_1.wrap(function _callee9$(_context9) {
|
|
4930
4990
|
while (1) {
|
|
4931
|
-
switch (
|
|
4991
|
+
switch (_context9.prev = _context9.next) {
|
|
4932
4992
|
case 0:
|
|
4933
|
-
return
|
|
4993
|
+
return _context9.abrupt("return", this.env.plygame.connect(this._networkConnection.signer).makeBetOnce(amount.rawAmount()));
|
|
4934
4994
|
|
|
4935
4995
|
case 1:
|
|
4936
4996
|
case "end":
|
|
4937
|
-
return
|
|
4997
|
+
return _context9.stop();
|
|
4938
4998
|
}
|
|
4939
4999
|
}
|
|
4940
|
-
},
|
|
5000
|
+
}, _callee9, this);
|
|
4941
5001
|
}));
|
|
4942
5002
|
|
|
4943
5003
|
function makeBetOnce(_x7) {
|
|
@@ -4948,19 +5008,19 @@ var PlyGameReadWrite = /*#__PURE__*/function (_PlyGameRead) {
|
|
|
4948
5008
|
}();
|
|
4949
5009
|
|
|
4950
5010
|
_proto2.approve = /*#__PURE__*/function () {
|
|
4951
|
-
var _approve = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4952
|
-
return runtime_1.wrap(function
|
|
5011
|
+
var _approve = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(amount) {
|
|
5012
|
+
return runtime_1.wrap(function _callee10$(_context10) {
|
|
4953
5013
|
while (1) {
|
|
4954
|
-
switch (
|
|
5014
|
+
switch (_context10.prev = _context10.next) {
|
|
4955
5015
|
case 0:
|
|
4956
|
-
return
|
|
5016
|
+
return _context10.abrupt("return", this.env.ply.connect(this._networkConnection.signer).approve(this.env.plygame.address, amount.rawAmount()));
|
|
4957
5017
|
|
|
4958
5018
|
case 1:
|
|
4959
5019
|
case "end":
|
|
4960
|
-
return
|
|
5020
|
+
return _context10.stop();
|
|
4961
5021
|
}
|
|
4962
5022
|
}
|
|
4963
|
-
},
|
|
5023
|
+
}, _callee10, this);
|
|
4964
5024
|
}));
|
|
4965
5025
|
|
|
4966
5026
|
function approve(_x8) {
|
|
@@ -5799,5 +5859,5 @@ BigNumber.config({
|
|
|
5799
5859
|
DECIMAL_PLACES: 50
|
|
5800
5860
|
});
|
|
5801
5861
|
|
|
5802
|
-
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 };
|
|
5803
5863
|
//# sourceMappingURL=sdk.esm.js.map
|