@aurigami/sdk 1.13.1 → 1.14.0
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/ChangeLog.md +376 -0
- package/dist/helpers/helpers.d.ts +0 -1
- package/dist/sdk.cjs.development.js +87 -59
- 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 +88 -59
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +2 -1
- package/src/.DS_Store +0 -0
- package/src/consts/constants.ts +0 -1
- package/src/helpers/helpers.ts +19 -19
- package/src/helpers/priceFetcher.ts +3 -1
- package/src/interactors/MoneyMarket.ts +15 -14
- package/src/interactors/PlyGame.ts +1 -1
package/dist/sdk.esm.js
CHANGED
|
@@ -23,6 +23,7 @@ export { default as TESTNET_ADDRESSES } from '@aurigami/contracts/deployments/au
|
|
|
23
23
|
import axios from 'axios';
|
|
24
24
|
import { Signer } from '@ethersproject/abstract-signer';
|
|
25
25
|
import { __decorate, __metadata } from 'tslib';
|
|
26
|
+
import { cache, CacheType } from 'cache-decorator';
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
|
|
@@ -131,7 +132,7 @@ var networkAddresses = {
|
|
|
131
132
|
AURORA_WNEAR: /*#__PURE__*/'0x1e0e812fbcd3eb75d8562ad6f310ed94d258d008'.toLowerCase()
|
|
132
133
|
}
|
|
133
134
|
};
|
|
134
|
-
var DEPOSIT_ONLY_TOKENS = [/*#__PURE__*/MAINNET_ADDRESSES.auTokens.
|
|
135
|
+
var DEPOSIT_ONLY_TOKENS = [/*#__PURE__*/MAINNET_ADDRESSES.auTokens.AURORA.toLowerCase(), /*#__PURE__*/MAINNET_ADDRESSES.auTokens.TRI.toLowerCase(), /*#__PURE__*/MAINNET_ADDRESSES.auTokens.PLY.toLowerCase(), /*#__PURE__*/MAINNET_ADDRESSES.auTokens.USN.toLowerCase()]; // All token that we can calculate the price via oracle + coingecko
|
|
135
136
|
|
|
136
137
|
var PRICE_WHITELISTED = /*#__PURE__*/new Set( /*#__PURE__*/[].concat( /*#__PURE__*/networkAddresses.auTokens.map(function (t) {
|
|
137
138
|
return t.underlying;
|
|
@@ -1534,37 +1535,25 @@ function sortEvents(events) {
|
|
|
1534
1535
|
|
|
1535
1536
|
return a.blockNumber - b.blockNumber;
|
|
1536
1537
|
});
|
|
1537
|
-
}
|
|
1538
|
-
function
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
return value;
|
|
1557
|
-
}
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
|
-
var result = originalMethod.apply(this, args);
|
|
1561
|
-
cache.set(key, [Date.now(), result]);
|
|
1562
|
-
return result;
|
|
1563
|
-
};
|
|
1564
|
-
|
|
1565
|
-
return descriptor;
|
|
1566
|
-
};
|
|
1567
|
-
}
|
|
1538
|
+
} // export function Cache(cacheTimeout: number) {
|
|
1539
|
+
// return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
|
|
1540
|
+
// const originalMethod = descriptor.value;
|
|
1541
|
+
// let cache = new Map<string, any>();
|
|
1542
|
+
// descriptor.value = function (...args: any[]) {
|
|
1543
|
+
// let key = JSON.stringify(args);
|
|
1544
|
+
// if (cache.has(key)) {
|
|
1545
|
+
// let [timestamp, value] = cache.get(key);
|
|
1546
|
+
// if (Date.now() - timestamp < cacheTimeout) {
|
|
1547
|
+
// return value;
|
|
1548
|
+
// }
|
|
1549
|
+
// }
|
|
1550
|
+
// let result = originalMethod.apply(this, args);
|
|
1551
|
+
// cache.set(key, [Date.now(), result]);
|
|
1552
|
+
// return result;
|
|
1553
|
+
// };
|
|
1554
|
+
// return descriptor;
|
|
1555
|
+
// };
|
|
1556
|
+
// }
|
|
1568
1557
|
|
|
1569
1558
|
var BlockchainEntityRead = function BlockchainEntityRead(networkConnection) {
|
|
1570
1559
|
this._networkConnection = networkConnection;
|
|
@@ -1951,6 +1940,7 @@ function _fetchPriceFromDefiLlamaAPI() {
|
|
|
1951
1940
|
return res.data.coins[id].price;
|
|
1952
1941
|
})["catch"](function (err) {
|
|
1953
1942
|
console.log("unable to fetch price from DefiLlama API: " + err);
|
|
1943
|
+
console.error(err);
|
|
1954
1944
|
return 0;
|
|
1955
1945
|
});
|
|
1956
1946
|
|
|
@@ -1984,6 +1974,7 @@ function _fetchPriceFromCoingeckoAPI() {
|
|
|
1984
1974
|
return res.data[id];
|
|
1985
1975
|
})["catch"](function (err) {
|
|
1986
1976
|
console.log("Unable to fetch price from Coingecko API for " + id);
|
|
1977
|
+
console.error(err);
|
|
1987
1978
|
return {
|
|
1988
1979
|
usd: 0
|
|
1989
1980
|
};
|
|
@@ -3098,7 +3089,6 @@ var helpers = {
|
|
|
3098
3089
|
getBlockBeforeTimestamp: getBlockBeforeTimestamp,
|
|
3099
3090
|
devLog: devLog,
|
|
3100
3091
|
sortEvents: sortEvents,
|
|
3101
|
-
Cache: Cache,
|
|
3102
3092
|
fetchPriceFromDefiLlamaAPI: fetchPriceFromDefiLlamaAPI,
|
|
3103
3093
|
fetchPriceFromCoingeckoAPI: fetchPriceFromCoingeckoAPI,
|
|
3104
3094
|
fetchPriceFromDefiLlama: fetchPriceFromDefiLlama,
|
|
@@ -4042,31 +4032,70 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4042
4032
|
return MoneyMarketRead;
|
|
4043
4033
|
}(BlockchainEntityRead);
|
|
4044
4034
|
|
|
4045
|
-
__decorate([
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
__decorate([
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
__decorate([
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4035
|
+
__decorate([cache({
|
|
4036
|
+
ttl: CACHE_TIMEOUT,
|
|
4037
|
+
type: CacheType.MEMO
|
|
4038
|
+
}), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getUnderlyingPrice", null);
|
|
4039
|
+
|
|
4040
|
+
__decorate([cache({
|
|
4041
|
+
ttl: CACHE_TIMEOUT,
|
|
4042
|
+
type: CacheType.MEMO
|
|
4043
|
+
}), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getPlyPrice", null);
|
|
4044
|
+
|
|
4045
|
+
__decorate([cache({
|
|
4046
|
+
ttl: CACHE_TIMEOUT,
|
|
4047
|
+
type: CacheType.MEMO
|
|
4048
|
+
}), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getRewardSpeeds", null);
|
|
4049
|
+
|
|
4050
|
+
__decorate([cache({
|
|
4051
|
+
ttl: CACHE_TIMEOUT,
|
|
4052
|
+
type: CacheType.MEMO
|
|
4053
|
+
}), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getTotalTokenBorrowed", null);
|
|
4054
|
+
|
|
4055
|
+
__decorate([cache({
|
|
4056
|
+
ttl: CACHE_TIMEOUT,
|
|
4057
|
+
type: CacheType.MEMO
|
|
4058
|
+
}), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getTotalTokenDeposited", null);
|
|
4059
|
+
|
|
4060
|
+
__decorate([cache({
|
|
4061
|
+
ttl: CACHE_TIMEOUT,
|
|
4062
|
+
type: CacheType.MEMO
|
|
4063
|
+
}), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getDepositAPY", null);
|
|
4064
|
+
|
|
4065
|
+
__decorate([cache({
|
|
4066
|
+
ttl: CACHE_TIMEOUT,
|
|
4067
|
+
type: CacheType.MEMO
|
|
4068
|
+
}), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getBorrowAPY", null);
|
|
4069
|
+
|
|
4070
|
+
__decorate([cache({
|
|
4071
|
+
ttl: CACHE_TIMEOUT,
|
|
4072
|
+
type: CacheType.MEMO
|
|
4073
|
+
}), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getCollateralRatio", null);
|
|
4074
|
+
|
|
4075
|
+
__decorate([cache({
|
|
4076
|
+
ttl: CACHE_TIMEOUT,
|
|
4077
|
+
type: CacheType.MEMO
|
|
4078
|
+
}), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getBorrowPlyAPY", null);
|
|
4079
|
+
|
|
4080
|
+
__decorate([cache({
|
|
4081
|
+
ttl: CACHE_TIMEOUT,
|
|
4082
|
+
type: CacheType.MEMO
|
|
4083
|
+
}), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getDepositPlyAPY", null);
|
|
4084
|
+
|
|
4085
|
+
__decorate([cache({
|
|
4086
|
+
ttl: CACHE_TIMEOUT,
|
|
4087
|
+
type: CacheType.MEMO
|
|
4088
|
+
}), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getDepositNearAPY", null);
|
|
4089
|
+
|
|
4090
|
+
__decorate([cache({
|
|
4091
|
+
ttl: CACHE_TIMEOUT,
|
|
4092
|
+
type: CacheType.MEMO
|
|
4093
|
+
}), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getBorrowNearAPY", null);
|
|
4094
|
+
|
|
4095
|
+
__decorate([cache({
|
|
4096
|
+
ttl: CACHE_TIMEOUT,
|
|
4097
|
+
type: CacheType.MEMO
|
|
4098
|
+
}), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getDepositMetaAPY", null);
|
|
4070
4099
|
|
|
4071
4100
|
var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
4072
4101
|
_inheritsLoose(MoneyMarketReadWrite, _MoneyMarketRead);
|
|
@@ -7103,5 +7132,5 @@ BigNumber.config({
|
|
|
7103
7132
|
DECIMAL_PLACES: 50
|
|
7104
7133
|
});
|
|
7105
7134
|
|
|
7106
|
-
export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, AURORA_PLUS_API_PREFIX, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, CACHE_TIMEOUT,
|
|
7135
|
+
export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, AURORA_PLUS_API_PREFIX, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, CACHE_TIMEOUT, 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, calcNetApy, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchHistoricalLPPositions, fetchHistoricalLPPrice, fetchHistoricalPULPPrice, fetchHistoricalPrice, fetchHistoricalPriceByLP, fetchHistoricalPriceFromOracle, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromDefiLlama, fetchPriceFromDefiLlamaAPI, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getApi, getBlockBeforeTimestamp, getBlockTimestamp, getBlocksTimestamp, getBlocksTimestampViaRPC, getCurrentTimestamp, getDecimal, getPaginatedApi, getQuery, getSymbol, getUnderlying, isSameAddress, networkAddresses, queryGraphQL, referralRewardDummy1, referralRewardDummy2, sleep, sortEvents, symbolRecords, validateAndParseAddress, valuateToken };
|
|
7107
7136
|
//# sourceMappingURL=sdk.esm.js.map
|