@alphafi/alphafi-sdk 0.0.41 → 0.0.43
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/cjs/common/constants.d.ts.map +1 -1
- package/dist/cjs/common/constants.js +5 -5
- package/dist/cjs/common/constants.js.map +1 -1
- package/dist/cjs/common/pyth.d.ts +1 -1
- package/dist/cjs/common/pyth.d.ts.map +1 -1
- package/dist/cjs/common/pyth.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/getReceipts.d.ts +4 -0
- package/dist/cjs/sui-sdk/functions/getReceipts.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/getReceipts.js +41 -2
- package/dist/cjs/sui-sdk/functions/getReceipts.js.map +1 -1
- package/dist/cjs/transactions/alpha.d.ts.map +1 -1
- package/dist/cjs/transactions/alpha.js +1 -0
- package/dist/cjs/transactions/alpha.js.map +1 -1
- package/dist/cjs/transactions/deposit.d.ts.map +1 -1
- package/dist/cjs/transactions/deposit.js +2 -0
- package/dist/cjs/transactions/deposit.js.map +1 -1
- package/dist/cjs/transactions/withdraw.js +1 -0
- package/dist/cjs/transactions/withdraw.js.map +1 -1
- package/dist/cjs/transactions/zapDeposit.d.ts.map +1 -1
- package/dist/cjs/transactions/zapDeposit.js +57 -1
- package/dist/cjs/transactions/zapDeposit.js.map +1 -1
- package/dist/cjs/utils/prices.d.ts.map +1 -1
- package/dist/cjs/utils/prices.js +16 -2
- package/dist/cjs/utils/prices.js.map +1 -1
- package/dist/cjs/utils/simpleCache.d.ts +2 -0
- package/dist/cjs/utils/simpleCache.d.ts.map +1 -1
- package/dist/cjs/utils/simpleCache.js +47 -0
- package/dist/cjs/utils/simpleCache.js.map +1 -1
- package/dist/esm/common/constants.d.ts.map +1 -1
- package/dist/esm/common/constants.js +5 -5
- package/dist/esm/common/constants.js.map +1 -1
- package/dist/esm/common/pyth.d.ts +1 -1
- package/dist/esm/common/pyth.d.ts.map +1 -1
- package/dist/esm/common/pyth.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/sui-sdk/functions/getReceipts.d.ts +4 -0
- package/dist/esm/sui-sdk/functions/getReceipts.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/getReceipts.js +40 -2
- package/dist/esm/sui-sdk/functions/getReceipts.js.map +1 -1
- package/dist/esm/transactions/alpha.d.ts.map +1 -1
- package/dist/esm/transactions/alpha.js +1 -0
- package/dist/esm/transactions/alpha.js.map +1 -1
- package/dist/esm/transactions/deposit.d.ts.map +1 -1
- package/dist/esm/transactions/deposit.js +2 -0
- package/dist/esm/transactions/deposit.js.map +1 -1
- package/dist/esm/transactions/withdraw.js +1 -0
- package/dist/esm/transactions/withdraw.js.map +1 -1
- package/dist/esm/transactions/zapDeposit.d.ts.map +1 -1
- package/dist/esm/transactions/zapDeposit.js +57 -1
- package/dist/esm/transactions/zapDeposit.js.map +1 -1
- package/dist/esm/utils/prices.d.ts.map +1 -1
- package/dist/esm/utils/prices.js +16 -2
- package/dist/esm/utils/prices.js.map +1 -1
- package/dist/esm/utils/simpleCache.d.ts +2 -0
- package/dist/esm/utils/simpleCache.d.ts.map +1 -1
- package/dist/esm/utils/simpleCache.js +46 -0
- package/dist/esm/utils/simpleCache.js.map +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/functions/alphaLpBreakdown.html +1 -1
- package/docs/functions/cetusLpBreakdown.html +1 -1
- package/docs/functions/claimRewardTxb.html +1 -1
- package/docs/functions/coinAmountToXTokensDoubleAsset.html +1 -1
- package/docs/functions/coinAmountToXTokensSingleAsset.html +1 -1
- package/docs/functions/coinsInPool.html +1 -1
- package/docs/functions/collectRewards.html +1 -1
- package/docs/functions/deposit.html +1 -1
- package/docs/functions/depositDoubleAssetTxb.html +1 -1
- package/docs/functions/depositSingleAssetTxb.html +1 -1
- package/docs/functions/fetchAfterTransactionEvents.html +1 -1
- package/docs/functions/fetchAutoCompoundingEvents.html +1 -1
- package/docs/functions/fetchAutoCompoundingEventsGql.html +1 -1
- package/docs/functions/fetchCetusPools.html +1 -1
- package/docs/functions/fetchChainIdentifier.html +1 -1
- package/docs/functions/fetchCheckRatioEvents.html +1 -1
- package/docs/functions/fetchLiquidityChangeEvents.html +1 -1
- package/docs/functions/fetchMultiReceipts.html +1 -1
- package/docs/functions/fetchNftHolders.html +1 -1
- package/docs/functions/fetchPools.html +1 -1
- package/docs/functions/fetchPortfolioData.html +1 -1
- package/docs/functions/fetchProtocolData.html +1 -1
- package/docs/functions/fetchTVL.html +1 -1
- package/docs/functions/fetchUserVaultBalances.html +1 -1
- package/docs/functions/fetchUserVaults.html +1 -1
- package/docs/functions/fetchUserWalletData.html +1 -1
- package/docs/functions/fetchWithdrawV2Events.html +1 -1
- package/docs/functions/getAirdropShare.html +1 -1
- package/docs/functions/getAllDoubleAssetVaults.html +1 -1
- package/docs/functions/getAllSingleAssetVaults.html +1 -1
- package/docs/functions/getAllVaultBalances.html +1 -1
- package/docs/functions/getAllVaults.html +1 -1
- package/docs/functions/getAlphaUnlocks.html +1 -1
- package/docs/functions/getAlphaVaultBalance.html +1 -1
- package/docs/functions/getAmounts.html +1 -1
- package/docs/functions/getApr.html +1 -1
- package/docs/functions/getAprs.html +1 -1
- package/docs/functions/getApy.html +1 -1
- package/docs/functions/getApys.html +1 -1
- package/docs/functions/getCetusInvestorTicksMap.html +1 -1
- package/docs/functions/getCetusSqrtPriceMap.html +1 -1
- package/docs/functions/getCoinAmountsFromLiquidity.html +1 -1
- package/docs/functions/getConf.html +1 -1
- package/docs/functions/getCurrentTick.html +1 -1
- package/docs/functions/getDoubleAssetVaultBalance.html +1 -1
- package/docs/functions/getDoubleAssetVaults.html +1 -1
- package/docs/functions/getHoldersFromTransactions.html +1 -1
- package/docs/functions/getInvestor.html +1 -1
- package/docs/functions/getInvestorPoolMap.html +1 -1
- package/docs/functions/getLastAutoCompoundTime.html +1 -1
- package/docs/functions/getLatestPrices.html +1 -1
- package/docs/functions/getLiquidity.html +1 -1
- package/docs/functions/getMultiInvestor.html +1 -1
- package/docs/functions/getMultiLatestPrices.html +1 -1
- package/docs/functions/getMultiParentPool.html +1 -1
- package/docs/functions/getMultiPool.html +1 -1
- package/docs/functions/getMultiReceipts.html +1 -1
- package/docs/functions/getParentPool.html +1 -1
- package/docs/functions/getPool.html +1 -1
- package/docs/functions/getPoolExchangeRateMap.html +1 -1
- package/docs/functions/getPositionRange.html +1 -1
- package/docs/functions/getPositionRanges.html +1 -0
- package/docs/functions/getPositionTicks.html +1 -1
- package/docs/functions/getPriceToTick.html +1 -1
- package/docs/functions/getRebalanceHistories.html +1 -1
- package/docs/functions/getRebalanceHistory.html +1 -1
- package/docs/functions/getReceipts.html +1 -1
- package/docs/functions/getSingleAssetVaultBalance.html +1 -1
- package/docs/functions/getSingleAssetVaults.html +1 -1
- package/docs/functions/getSuiClient.html +2 -2
- package/docs/functions/getSuiNodeUrl.html +2 -2
- package/docs/functions/getTVLs.html +1 -1
- package/docs/functions/getTickToPrice.html +1 -1
- package/docs/functions/getUserTokensFromTransactions.html +1 -1
- package/docs/functions/getUserTokensInUsdFromTransactions.html +1 -1
- package/docs/functions/getVaultBalance.html +1 -1
- package/docs/functions/getVaultBalanceForActiveUsers.html +1 -1
- package/docs/functions/getVaults.html +1 -1
- package/docs/functions/getXTokenVaultBalanceForActiveUsers.html +1 -1
- package/docs/functions/getZapAmounts.html +1 -1
- package/docs/functions/lastAutocompoundTime.html +1 -1
- package/docs/functions/liquidityToTokens.html +1 -1
- package/docs/functions/multiLiquidityToTokens.html +1 -1
- package/docs/functions/multiTokensToUsd.html +1 -1
- package/docs/functions/multiXTokensToLiquidity.html +1 -1
- package/docs/functions/parseUserWalletData.html +1 -1
- package/docs/functions/setSuiClient.html +2 -2
- package/docs/functions/setSuiNodeUrl.html +2 -2
- package/docs/functions/withdraw.html +1 -1
- package/docs/functions/withdrawAlphaTxb.html +1 -1
- package/docs/functions/withdrawTxb.html +1 -1
- package/docs/functions/zapDepositTxb.html +1 -1
- package/docs/index.html +2 -2
- package/docs/interfaces/Coin.html +6 -6
- package/docs/interfaces/CoinPair.html +2 -2
- package/docs/interfaces/NaviVoloData.html +2 -2
- package/docs/interfaces/RebalanceHistoryType.html +2 -2
- package/docs/modules.html +3 -2
- package/docs/types/AfterTransactionEventNode.html +1 -1
- package/docs/types/Allocator.html +1 -1
- package/docs/types/AlphaFiDoubleAssetVault.html +1 -1
- package/docs/types/AlphaFiMultiVaultBalance.html +1 -1
- package/docs/types/AlphaFiSingleAssetVault.html +1 -1
- package/docs/types/AlphaFiVault.html +1 -1
- package/docs/types/AlphaFiVaultBalance.html +1 -1
- package/docs/types/AlphaPoolType.html +1 -1
- package/docs/types/AlphaReceipt.html +1 -1
- package/docs/types/AlphaReceiptFields.html +1 -1
- package/docs/types/AlphaVaultBalance.html +1 -1
- package/docs/types/AutoCompoundingEventNode.html +1 -1
- package/docs/types/BluefinInvestor.html +1 -1
- package/docs/types/BluefinPoolType.html +1 -1
- package/docs/types/BucketInvestor.html +1 -1
- package/docs/types/CetusInvestor.html +1 -1
- package/docs/types/CetusPoolType.html +1 -1
- package/docs/types/CetusSwapOptions.html +1 -1
- package/docs/types/CoinAmounts.html +1 -1
- package/docs/types/CoinName.html +1 -1
- package/docs/types/CoinType.html +1 -1
- package/docs/types/CommonInvestorFields.html +1 -1
- package/docs/types/CreatePoolOptions.html +1 -1
- package/docs/types/Distributor.html +1 -1
- package/docs/types/DoubleAssetMultiVaultBalance.html +1 -1
- package/docs/types/DoubleAssetPoolNames.html +1 -1
- package/docs/types/DoubleAssetTokenHoldings.html +1 -1
- package/docs/types/DoubleAssetVaultBalance.html +1 -1
- package/docs/types/GetHoldersParams.html +1 -1
- package/docs/types/GetTokenHoldingsParams.html +1 -1
- package/docs/types/GetUserTokensFromTransactionsParams.html +1 -1
- package/docs/types/GetUserTokensInUsdFromTransactionsParams.html +1 -1
- package/docs/types/GetVaultBalanceForActiveUsersParams.html +1 -1
- package/docs/types/GetVaultBalanceParams.html +1 -1
- package/docs/types/HoldingsObj.html +1 -1
- package/docs/types/Icon.html +1 -1
- package/docs/types/Investor.html +1 -1
- package/docs/types/LiquidityChangeEventNode.html +1 -1
- package/docs/types/LiquidityToTokensParams.html +1 -1
- package/docs/types/LiquidityToUsdParams.html +1 -1
- package/docs/types/LoopingDebt.html +1 -1
- package/docs/types/LpBreakdownType.html +1 -1
- package/docs/types/MemberPoolDataType.html +1 -1
- package/docs/types/MemberType.html +1 -1
- package/docs/types/MultiGetVaultBalancesParams.html +1 -1
- package/docs/types/NaviInvestor.html +1 -1
- package/docs/types/OtherReceiptFields.html +1 -1
- package/docs/types/PoolName.html +1 -1
- package/docs/types/PoolReceipt.html +1 -1
- package/docs/types/PoolType.html +1 -1
- package/docs/types/Receipt.html +1 -1
- package/docs/types/ReceiptGQL.html +1 -1
- package/docs/types/SingleAssetMultiVaultBalance.html +1 -1
- package/docs/types/SingleAssetPoolNames.html +1 -1
- package/docs/types/SingleAssetTokenHoldings.html +1 -1
- package/docs/types/SingleAssetVaultBalance.html +1 -1
- package/docs/types/SingleGetVaultBalancesParams.html +1 -1
- package/docs/types/StrategyType.html +1 -1
- package/docs/types/SuiNetwork.html +1 -1
- package/docs/types/SwapOptions.html +1 -1
- package/docs/types/TickSpacing.html +1 -1
- package/docs/types/TotalWeightType.html +1 -1
- package/docs/types/TransactionBlockType.html +1 -1
- package/docs/types/UserPoolLiquidity.html +1 -1
- package/docs/types/UserPoolTokenHoldings.html +1 -1
- package/docs/types/UserUsdHoldings.html +1 -1
- package/docs/types/VaultBalance.html +1 -1
- package/docs/types/WithdrawV2EventNode.html +1 -1
- package/docs/variables/bluefinPoolMap.html +1 -1
- package/docs/variables/cetusPoolMap.html +1 -1
- package/docs/variables/coinsList.html +1 -1
- package/docs/variables/defunctPoolsSet.html +1 -1
- package/docs/variables/doubleAssetPoolCoinMap.html +1 -1
- package/docs/variables/ignoredWalletsForDailyRevenue.html +1 -1
- package/docs/variables/loopingAccountAddresses.html +1 -1
- package/docs/variables/loopingPoolCoinMap.html +1 -1
- package/docs/variables/naviAssetMap.html +1 -1
- package/docs/variables/poolIdPoolNameMap.html +1 -1
- package/docs/variables/poolInfo.html +1 -1
- package/docs/variables/singleAssetPoolCoinMap.html +1 -1
- package/docs/variables/stableCoins.html +1 -1
- package/package.json +2 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GetObjectParams, SuiObjectResponse } from "@mysten/sui/client";
|
|
1
2
|
export declare class SimpleCache<T> {
|
|
2
3
|
private cache;
|
|
3
4
|
private defaultTTL;
|
|
@@ -7,4 +8,5 @@ export declare class SimpleCache<T> {
|
|
|
7
8
|
delete(key: string): void;
|
|
8
9
|
clear(): void;
|
|
9
10
|
}
|
|
11
|
+
export declare function getObjectFromChain(input: GetObjectParams, ignoreCache: boolean): Promise<SuiObjectResponse>;
|
|
10
12
|
//# sourceMappingURL=simpleCache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleCache.d.ts","sourceRoot":"","sources":["../../../src/utils/simpleCache.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAW,CAAC,CAAC;IACxB,OAAO,CAAC,KAAK,CAAuD;IACpE,OAAO,CAAC,UAAU,CAAS;gBAEf,UAAU,GAAE,MAAc;IAKtC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAW1B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAK9C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIzB,KAAK,IAAI,IAAI;CAGd"}
|
|
1
|
+
{"version":3,"file":"simpleCache.d.ts","sourceRoot":"","sources":["../../../src/utils/simpleCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGxE,qBAAa,WAAW,CAAC,CAAC;IACxB,OAAO,CAAC,KAAK,CAAuD;IACpE,OAAO,CAAC,UAAU,CAAS;gBAEf,UAAU,GAAE,MAAc;IAKtC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAW1B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAK9C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIzB,KAAK,IAAI,IAAI;CAGd;AAoBD,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,eAAe,EACtB,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,iBAAiB,CAAC,CAuC5B"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SimpleCache = void 0;
|
|
4
|
+
exports.getObjectFromChain = getObjectFromChain;
|
|
5
|
+
const client_js_1 = require("../sui-sdk/client.js");
|
|
4
6
|
class SimpleCache {
|
|
5
7
|
constructor(defaultTTL = 60000) {
|
|
6
8
|
this.cache = {};
|
|
@@ -40,4 +42,49 @@ exports.SimpleCache = SimpleCache;
|
|
|
40
42
|
// cache.delete('example');
|
|
41
43
|
// // Clear all cache entries
|
|
42
44
|
// cache.clear();
|
|
45
|
+
const getObjectCache = new SimpleCache();
|
|
46
|
+
const getObjectPromiseCache = new SimpleCache();
|
|
47
|
+
async function getObjectFromChain(input, ignoreCache) {
|
|
48
|
+
const suiClient = (0, client_js_1.getSuiClient)();
|
|
49
|
+
const cacheKey = `getObject_${input.id}`;
|
|
50
|
+
if (ignoreCache) {
|
|
51
|
+
getObjectCache.delete(cacheKey);
|
|
52
|
+
getObjectPromiseCache.delete(cacheKey);
|
|
53
|
+
}
|
|
54
|
+
// Check if the distributor is already in the cache
|
|
55
|
+
const cachedObject = getObjectCache.get(cacheKey);
|
|
56
|
+
if (cachedObject) {
|
|
57
|
+
return cachedObject;
|
|
58
|
+
}
|
|
59
|
+
// Check if there is already a promise in the cache
|
|
60
|
+
let getObjectPromise = getObjectPromiseCache.get(cacheKey);
|
|
61
|
+
if (getObjectPromise) {
|
|
62
|
+
return getObjectPromise;
|
|
63
|
+
}
|
|
64
|
+
// If not, create a new promise and cache it
|
|
65
|
+
getObjectPromise = (async () => {
|
|
66
|
+
try {
|
|
67
|
+
const res = await suiClient.getObject(input);
|
|
68
|
+
// Cache the distributor object
|
|
69
|
+
getObjectCache.set(cacheKey, res);
|
|
70
|
+
return res;
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
console.error(`getDistributor failed`);
|
|
74
|
+
throw err;
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
// Remove the promise from the cache after it resolves
|
|
78
|
+
getObjectPromiseCache.delete(cacheKey);
|
|
79
|
+
}
|
|
80
|
+
})();
|
|
81
|
+
// Cache the promise
|
|
82
|
+
getObjectPromiseCache.set(cacheKey, getObjectPromise);
|
|
83
|
+
return getObjectPromise;
|
|
84
|
+
}
|
|
85
|
+
// suiClient.getDynamicFields
|
|
86
|
+
// suiClient.getDynamicFieldObject
|
|
87
|
+
// suiClient.getOwnedObjects
|
|
88
|
+
// suiClient.multiGetObjects
|
|
89
|
+
// suiClient.getCoins
|
|
43
90
|
//# sourceMappingURL=simpleCache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleCache.js","sourceRoot":"","sources":["../../../src/utils/simpleCache.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"simpleCache.js","sourceRoot":"","sources":["../../../src/utils/simpleCache.ts"],"names":[],"mappings":";;;AAu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AC5B,4BAA4B;AAC5B,qBAAqB","sourcesContent":["import { GetObjectParams, SuiObjectResponse } from \"@mysten/sui/client\";\nimport { getSuiClient } from \"../sui-sdk/client.js\";\n\nexport class SimpleCache<T> {\n private cache: { [key: string]: { value: T; expiry: number } } = {};\n private defaultTTL: number;\n\n constructor(defaultTTL: number = 60000) {\n // Default TTL is 60 seconds\n this.defaultTTL = defaultTTL;\n }\n\n get(key: string): T | null {\n const cacheEntry = this.cache[key];\n if (cacheEntry && cacheEntry.expiry > Date.now()) {\n return cacheEntry.value;\n } else {\n // If the entry has expired, delete it\n this.delete(key);\n return null;\n }\n }\n\n set(key: string, value: T, ttl?: number): void {\n const expiry = Date.now() + (ttl || this.defaultTTL);\n this.cache[key] = { value, expiry };\n }\n\n delete(key: string): void {\n delete this.cache[key];\n }\n\n clear(): void {\n this.cache = {};\n }\n}\n\n// // Usage example:\n// const cache = new SimpleCache<string>(60000); // TTL of 60 seconds\n\n// // Set a cache entry\n// cache.set('example', 'value');\n\n// // Get a cache entry\n// const value = cache.get('example');\n\n// // Delete a specific cache entry\n// cache.delete('example');\n\n// // Clear all cache entries\n// cache.clear();\n\nconst getObjectCache = new SimpleCache<SuiObjectResponse>();\nconst getObjectPromiseCache = new SimpleCache<Promise<SuiObjectResponse>>();\n\nexport async function getObjectFromChain(\n input: GetObjectParams,\n ignoreCache: boolean,\n): Promise<SuiObjectResponse> {\n const suiClient = getSuiClient();\n const cacheKey = `getObject_${input.id}`;\n if (ignoreCache) {\n getObjectCache.delete(cacheKey);\n getObjectPromiseCache.delete(cacheKey);\n }\n // Check if the distributor is already in the cache\n const cachedObject = getObjectCache.get(cacheKey);\n if (cachedObject) {\n return cachedObject;\n }\n\n // Check if there is already a promise in the cache\n let getObjectPromise = getObjectPromiseCache.get(cacheKey);\n if (getObjectPromise) {\n return getObjectPromise;\n }\n\n // If not, create a new promise and cache it\n getObjectPromise = (async () => {\n try {\n const res = await suiClient.getObject(input);\n\n // Cache the distributor object\n getObjectCache.set(cacheKey, res);\n return res;\n } catch (err) {\n console.error(`getDistributor failed`);\n throw err;\n } finally {\n // Remove the promise from the cache after it resolves\n getObjectPromiseCache.delete(cacheKey);\n }\n })();\n\n // Cache the promise\n getObjectPromiseCache.set(cacheKey, getObjectPromise);\n return getObjectPromise;\n}\n\n// suiClient.getDynamicFields\n// suiClient.getDynamicFieldObject\n// suiClient.getOwnedObjects\n// suiClient.multiGetObjects\n// suiClient.getCoins\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/common/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,eAAe,CAAC;AAErC,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEnB,CAAC"}
|
|
@@ -885,7 +885,7 @@ export const conf = {
|
|
|
885
885
|
ALPHAFI_BLUEFIN_STSUI_USDC_POOL: "0x95f0543f861584f1a3c3129c46901d5c5cc1d44e77eb57aab63eec55cd128f29",
|
|
886
886
|
ALPHAFI_BLUEFIN_STSUI_ETH_POOL: "",
|
|
887
887
|
ALPHAFI_BLUEFIN_STSUI_WSOL_POOL: "",
|
|
888
|
-
ALPHAFI_BLUEFIN_ALPHA_STSUI_POOL: "",
|
|
888
|
+
ALPHAFI_BLUEFIN_ALPHA_STSUI_POOL: "0xd601c2d1f451a1493e8d071482272a83e6dafbcdb82b249ca5b3ac909c4138f3",
|
|
889
889
|
// CETUS Pool Id's
|
|
890
890
|
WUSDC_SUI_CETUS_POOL_ID: "0xcf994611fd4c48e277ce3ffd4d4364c914af2c3cbb05f7bf6facd371de688630",
|
|
891
891
|
USDC_SUI_CETUS_POOL_ID: "0xb8d7d9e66a60c239e7a60110efcf8de6c705580ed924d0dde141f4a0e2c90105",
|
|
@@ -991,7 +991,7 @@ export const conf = {
|
|
|
991
991
|
ALPHAFI_BLUEFIN_STSUI_USDC_INVESTOR: "0x65e4af88e543e41c410f969801d53e40acb23da7be811e4c61d05a7d7d235b3b",
|
|
992
992
|
ALPHAFI_BLUEFIN_STSUI_ETH_INVESTOR: "",
|
|
993
993
|
ALPHAFI_BLUEFIN_STSUI_WSOL_INVESTOR: "",
|
|
994
|
-
ALPHAFI_BLUEFIN_ALPHA_STSUI_INVESTOR: "",
|
|
994
|
+
ALPHAFI_BLUEFIN_ALPHA_STSUI_INVESTOR: "0x959f6df092073b23c0ad0278a9cf070b6779f2edc9b7124108207b4d7b4e94ca",
|
|
995
995
|
// Receipt Types
|
|
996
996
|
ALPHA_POOL_RECEIPT: "0x9bbd650b8442abb082c20f3bc95a9434a8d47b4bef98b0832dab57c1a8ba7123::alphapool::Receipt",
|
|
997
997
|
ALPHA_SUI_POOL_RECEIPT: "0x9bbd650b8442abb082c20f3bc95a9434a8d47b4bef98b0832dab57c1a8ba7123::alphafi_cetus_sui_pool::Receipt",
|
|
@@ -1177,7 +1177,7 @@ export const conf = {
|
|
|
1177
1177
|
ALPHAFI_BLUEFIN_STSUI_USDC_POOL_AUTO_COMPOUNDING_EVENT: "0xff869e243a172cfef9a4551f4eef88ac4861be0f81b0e7a4b7840b6276f5ceeb::alphafi_bluefin_stsui_first_investor::AutoCompoundingEvent",
|
|
1178
1178
|
ALPHAFI_BLUEFIN_STSUI_ETH_POOL_AUTO_COMPOUNDING_EVENT: "0x2db488439eb7c31010515a6534ea185a99e17b287ef01b618a74cdd134552f4e::alphafi_bluefin_type_2_investor::AutoCompoundingEvent",
|
|
1179
1179
|
ALPHAFI_BLUEFIN_STSUI_WSOL_POOL_AUTO_COMPOUNDING_EVENT: "0x2db488439eb7c31010515a6534ea185a99e17b287ef01b618a74cdd134552f4e::alphafi_bluefin_type_2_investor::AutoCompoundingEvent",
|
|
1180
|
-
ALPHAFI_BLUEFIN_ALPHA_STSUI_POOL_AUTO_COMPOUNDING_EVENT: "
|
|
1180
|
+
ALPHAFI_BLUEFIN_ALPHA_STSUI_POOL_AUTO_COMPOUNDING_EVENT: "0xdb3f0d00c5aa1d24dd65dfcbaecb284e013a2c7e742be3cb979c7703a1b899c9::alphafi_bluefin_stsui_second_investor::AutoCompoundingEvent", //c
|
|
1181
1181
|
//Rebalance Event Types
|
|
1182
1182
|
ALPHA_SUI_POOL_REBALANCE_EVENT: "0x73754ff4132adde2c28995739e8bb403aeb7219ba92003245529681dbc379c08::alphafi_cetus_sui_investor::RebalancePoolEvent",
|
|
1183
1183
|
USDT_WUSDC_POOL_REBALANCE_EVENT: "0x73754ff4132adde2c28995739e8bb403aeb7219ba92003245529681dbc379c08::alphafi_cetus_investor::RebalancePoolEvent",
|
|
@@ -1220,7 +1220,7 @@ export const conf = {
|
|
|
1220
1220
|
ALPHAFI_BLUEFIN_STSUI_USDC_POOL_REBALANCE_EVENT: "0xff869e243a172cfef9a4551f4eef88ac4861be0f81b0e7a4b7840b6276f5ceeb::alphafi_bluefin_stsui_first_investor::RebalancePoolEvent",
|
|
1221
1221
|
ALPHAFI_BLUEFIN_STSUI_ETH_POOL_REBALANCE_EVENT: "0x2db488439eb7c31010515a6534ea185a99e17b287ef01b618a74cdd134552f4e::alphafi_bluefin_type_2_investor::RebalancePoolEvent",
|
|
1222
1222
|
ALPHAFI_BLUEFIN_STSUI_WSOL_POOL_REBALANCE_EVENT: "0x2db488439eb7c31010515a6534ea185a99e17b287ef01b618a74cdd134552f4e::alphafi_bluefin_type_2_investor::RebalancePoolEvent",
|
|
1223
|
-
ALPHAFI_BLUEFIN_ALPHA_STSUI_POOL_REBALANCE_EVENT: "
|
|
1223
|
+
ALPHAFI_BLUEFIN_ALPHA_STSUI_POOL_REBALANCE_EVENT: "0xdb3f0d00c5aa1d24dd65dfcbaecb284e013a2c7e742be3cb979c7703a1b899c9::alphafi_bluefin_stsui_second_investor::RebalancePoolEvent", //c
|
|
1224
1224
|
//Liquidity Change Event Types
|
|
1225
1225
|
ALPHA_POOL_LIQUIDITY_CHANGE_EVENT: "0x73754ff4132adde2c28995739e8bb403aeb7219ba92003245529681dbc379c08::alphapool::LiquidityChangeEvent",
|
|
1226
1226
|
ALPHA_SUI_POOL_LIQUIDITY_CHANGE_EVENT: "0x73754ff4132adde2c28995739e8bb403aeb7219ba92003245529681dbc379c08::alphafi_cetus_sui_pool::LiquidityChangeEvent",
|
|
@@ -1279,7 +1279,7 @@ export const conf = {
|
|
|
1279
1279
|
ALPHAFI_BLUEFIN_STSUI_USDC_POOL_LIQUIDITY_CHANGE_EVENT: "0xff869e243a172cfef9a4551f4eef88ac4861be0f81b0e7a4b7840b6276f5ceeb::alphafi_bluefin_stsui_first_pool::LiquidityChangeEvent",
|
|
1280
1280
|
ALPHAFI_BLUEFIN_STSUI_ETH_POOL_LIQUIDITY_CHANGE_EVENT: "0x2db488439eb7c31010515a6534ea185a99e17b287ef01b618a74cdd134552f4e::alphafi_bluefin_type_2_pool::LiquidityChangeEvent",
|
|
1281
1281
|
ALPHAFI_BLUEFIN_STSUI_WSOL_POOL_LIQUIDITY_CHANGE_EVENT: "0x2db488439eb7c31010515a6534ea185a99e17b287ef01b618a74cdd134552f4e::alphafi_bluefin_type_2_pool::LiquidityChangeEvent",
|
|
1282
|
-
ALPHAFI_BLUEFIN_ALPHA_STSUI_POOL_LIQUIDITY_CHANGE_EVENT: "
|
|
1282
|
+
ALPHAFI_BLUEFIN_ALPHA_STSUI_POOL_LIQUIDITY_CHANGE_EVENT: "0xdb3f0d00c5aa1d24dd65dfcbaecb284e013a2c7e742be3cb979c7703a1b899c9::alphafi_bluefin_stsui_second_pool::LiquidityChangeEvent", //c
|
|
1283
1283
|
// WithdrawV2 Events
|
|
1284
1284
|
ALPHA_POOL_WITHDRAW_V2_EVENT: "0x904f7b5fc4064adc1a3d49b263abe683660ba766f78abd84a454c37c1f102218::alphapool::WithdrawEventV2",
|
|
1285
1285
|
// After Transaction Event Types
|