aftermath-ts-sdk 1.1.97 → 1.2.0-refactor.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/dist/general/historicalData/historicalData.d.ts +1 -1
- package/dist/general/historicalData/historicalData.d.ts.map +1 -1
- package/dist/general/nfts/nftsApi.d.ts +1 -5
- package/dist/general/nfts/nftsApi.d.ts.map +1 -1
- package/dist/general/nfts/nftsApi.js +15 -29
- package/dist/general/nfts/nftsApiCasting.d.ts +0 -1
- package/dist/general/nfts/nftsApiCasting.d.ts.map +1 -1
- package/dist/general/nfts/nftsApiCasting.js +0 -10
- package/dist/general/nfts/nftsTypes.d.ts +0 -1
- package/dist/general/nfts/nftsTypes.d.ts.map +1 -1
- package/dist/general/prices/{coingecko/coinGeckoTypes.d.ts → coinGeckoTypes.d.ts} +1 -1
- package/dist/general/prices/coinGeckoTypes.d.ts.map +1 -0
- package/dist/general/providers/aftermath.d.ts.map +1 -1
- package/dist/general/providers/aftermath.js +1 -2
- package/dist/general/providers/aftermathApi.d.ts +1 -34
- package/dist/general/providers/aftermathApi.d.ts.map +1 -1
- package/dist/general/providers/aftermathApi.js +2 -90
- package/dist/general/types/castingTypes.d.ts +0 -7
- package/dist/general/types/castingTypes.d.ts.map +1 -1
- package/dist/general/types/configTypes.d.ts +0 -6
- package/dist/general/types/configTypes.d.ts.map +1 -1
- package/dist/general/types/generalTypes.d.ts +0 -3
- package/dist/general/types/generalTypes.d.ts.map +1 -1
- package/dist/general/types/index.d.ts +1 -0
- package/dist/general/types/index.d.ts.map +1 -1
- package/dist/general/types/index.js +1 -0
- package/dist/general/utils/helpers.d.ts +1 -16
- package/dist/general/utils/helpers.d.ts.map +1 -1
- package/dist/general/utils/helpers.js +2 -32
- package/dist/general/utils/index.d.ts +0 -1
- package/dist/general/utils/index.d.ts.map +1 -1
- package/dist/general/utils/index.js +0 -1
- package/dist/packages/coin/api/coinApi.d.ts +1 -12
- package/dist/packages/coin/api/coinApi.d.ts.map +1 -1
- package/dist/packages/coin/api/coinApi.js +0 -123
- package/dist/packages/dca/api/dcaApi.d.ts +1 -28
- package/dist/packages/dca/api/dcaApi.d.ts.map +1 -1
- package/dist/packages/dca/api/dcaApi.js +0 -172
- package/dist/packages/farms/api/farmsApi.d.ts +1 -24
- package/dist/packages/farms/api/farmsApi.d.ts.map +1 -1
- package/dist/packages/farms/api/farmsApi.js +0 -69
- package/dist/packages/farms/api/farmsApiCasting.d.ts +2 -3
- package/dist/packages/farms/api/farmsApiCasting.d.ts.map +1 -1
- package/dist/packages/farms/api/farmsApiCasting.js +0 -45
- package/dist/packages/farms/api/farmsApiCastingTypes.d.ts +0 -9
- package/dist/packages/farms/api/farmsApiCastingTypes.d.ts.map +1 -1
- package/dist/packages/faucet/api/faucetApi.d.ts +0 -5
- package/dist/packages/faucet/api/faucetApi.d.ts.map +1 -1
- package/dist/packages/faucet/api/faucetApi.js +2 -29
- package/dist/packages/faucet/faucet.d.ts +3 -2
- package/dist/packages/faucet/faucet.d.ts.map +1 -1
- package/dist/packages/faucet/faucet.js +2 -2
- package/dist/packages/leveragedStaking/api/leveragedStakingApi.d.ts.map +1 -1
- package/dist/packages/leveragedStaking/api/leveragedStakingApi.js +383 -298
- package/dist/packages/nftAmm/nftAmmMarket.d.ts +9 -5
- package/dist/packages/nftAmm/nftAmmMarket.d.ts.map +1 -1
- package/dist/packages/nftAmm/nftAmmMarket.js +34 -6
- package/dist/packages/oracle/api/oracleApi.d.ts +1 -10
- package/dist/packages/oracle/api/oracleApi.d.ts.map +1 -1
- package/dist/packages/oracle/api/oracleApi.js +0 -38
- package/dist/packages/perpetuals/api/perpetualsApi.d.ts +2 -58
- package/dist/packages/perpetuals/api/perpetualsApi.d.ts.map +1 -1
- package/dist/packages/perpetuals/api/perpetualsApi.js +0 -735
- package/dist/packages/pools/api/poolsApi.d.ts +2 -217
- package/dist/packages/pools/api/poolsApi.d.ts.map +1 -1
- package/dist/packages/pools/api/poolsApi.js +0 -752
- package/dist/packages/pools/api/poolsApiCasting.d.ts +3 -15
- package/dist/packages/pools/api/poolsApiCasting.d.ts.map +1 -1
- package/dist/packages/pools/api/poolsApiCasting.js +0 -86
- package/dist/packages/pools/api/poolsApiCastingTypes.d.ts +1 -15
- package/dist/packages/pools/api/poolsApiCastingTypes.d.ts.map +1 -1
- package/dist/packages/pools/pools.d.ts +4 -1
- package/dist/packages/pools/pools.d.ts.map +1 -1
- package/dist/packages/pools/pools.js +5 -0
- package/dist/packages/router/api/routerApi.d.ts +2 -116
- package/dist/packages/router/api/routerApi.d.ts.map +1 -1
- package/dist/packages/router/api/routerApi.js +3 -345
- package/dist/packages/router/api/routerApiCasting.d.ts +2 -5
- package/dist/packages/router/api/routerApiCasting.d.ts.map +1 -1
- package/dist/packages/router/api/routerApiCasting.js +0 -104
- package/dist/packages/router/api/routerApiCastingTypes.d.ts +1 -13
- package/dist/packages/router/api/routerApiCastingTypes.d.ts.map +1 -1
- package/dist/packages/router/routerTypes.d.ts +3 -35
- package/dist/packages/router/routerTypes.d.ts.map +1 -1
- package/dist/packages/staking/api/stakingApi.d.ts +2 -50
- package/dist/packages/staking/api/stakingApi.d.ts.map +1 -1
- package/dist/packages/staking/api/stakingApi.js +0 -226
- package/dist/packages/staking/api/stakingApiCasting.d.ts +2 -4
- package/dist/packages/staking/api/stakingApiCasting.d.ts.map +1 -1
- package/dist/packages/staking/api/stakingApiCasting.js +0 -21
- package/dist/packages/staking/api/stakingApiCastingTypes.d.ts +1 -8
- package/dist/packages/staking/api/stakingApiCastingTypes.d.ts.map +1 -1
- package/dist/packages/staking/stakingTypes.d.ts +2 -0
- package/dist/packages/staking/stakingTypes.d.ts.map +1 -1
- package/dist/packages/sui/api/suiApi.d.ts +1 -2
- package/dist/packages/sui/api/suiApi.d.ts.map +1 -1
- package/dist/packages/sui/api/suiApi.js +0 -3
- package/package.json +1 -1
- package/dist/general/dynamicGas/dynamicGasApi.d.ts +0 -15
- package/dist/general/dynamicGas/dynamicGasApi.d.ts.map +0 -1
- package/dist/general/dynamicGas/dynamicGasApi.js +0 -87
- package/dist/general/historicalData/historicalDataApi.d.ts +0 -9
- package/dist/general/historicalData/historicalDataApi.d.ts.map +0 -1
- package/dist/general/historicalData/historicalDataApi.js +0 -13
- package/dist/general/historicalData/historicalDataApiInterface.d.ts +0 -12
- package/dist/general/historicalData/historicalDataApiInterface.d.ts.map +0 -1
- package/dist/general/historicalData/historicalDataApiInterface.js +0 -2
- package/dist/general/historicalData/placeholderHistoricalDataApi.d.ts +0 -13
- package/dist/general/historicalData/placeholderHistoricalDataApi.d.ts.map +0 -1
- package/dist/general/historicalData/placeholderHistoricalDataApi.js +0 -26
- package/dist/general/prices/coingecko/coinGeckoApiHelpers.d.ts +0 -22
- package/dist/general/prices/coingecko/coinGeckoApiHelpers.d.ts.map +0 -1
- package/dist/general/prices/coingecko/coinGeckoApiHelpers.js +0 -179
- package/dist/general/prices/coingecko/coinGeckoPricesApi.d.ts +0 -23
- package/dist/general/prices/coingecko/coinGeckoPricesApi.d.ts.map +0 -1
- package/dist/general/prices/coingecko/coinGeckoPricesApi.js +0 -113
- package/dist/general/prices/coingecko/coinGeckoTypes.d.ts.map +0 -1
- package/dist/general/prices/placeholder/placeholderPricesApi.d.ts +0 -20
- package/dist/general/prices/placeholder/placeholderPricesApi.d.ts.map +0 -1
- package/dist/general/prices/placeholder/placeholderPricesApi.js +0 -85
- package/dist/general/prices/pricesApiInterface.d.ts +0 -13
- package/dist/general/prices/pricesApiInterface.d.ts.map +0 -1
- package/dist/general/prices/pricesApiInterface.js +0 -2
- package/dist/general/prices/pyth/pythPricesApi.d.ts +0 -2
- package/dist/general/prices/pyth/pythPricesApi.d.ts.map +0 -1
- package/dist/general/prices/pyth/pythPricesApi.js +0 -52
- package/dist/general/prices/pyth/pythPricesApiHelpers.d.ts +0 -13
- package/dist/general/prices/pyth/pythPricesApiHelpers.d.ts.map +0 -1
- package/dist/general/prices/pyth/pythPricesApiHelpers.js +0 -77
- package/dist/general/prices/router/routerPricesApi.d.ts +0 -18
- package/dist/general/prices/router/routerPricesApi.d.ts.map +0 -1
- package/dist/general/prices/router/routerPricesApi.js +0 -126
- package/dist/general/utils/indexerCaller.d.ts +0 -14
- package/dist/general/utils/indexerCaller.d.ts.map +0 -1
- package/dist/general/utils/indexerCaller.js +0 -129
- /package/dist/general/prices/{coingecko/coinGeckoTypes.js → coinGeckoTypes.js} +0 -0
|
@@ -17,7 +17,6 @@ const inspectionsApiHelpers_1 = require("../apiHelpers/inspectionsApiHelpers");
|
|
|
17
17
|
const objectsApiHelpers_1 = require("../apiHelpers/objectsApiHelpers");
|
|
18
18
|
const transactionsApiHelpers_1 = require("../apiHelpers/transactionsApiHelpers");
|
|
19
19
|
const casting_1 = require("./casting");
|
|
20
|
-
const __1 = require("../..");
|
|
21
20
|
const utils_1 = require("@mysten/sui/utils");
|
|
22
21
|
/**
|
|
23
22
|
* A utility class containing various helper functions for general use.
|
|
@@ -44,9 +43,9 @@ class Helpers {
|
|
|
44
43
|
static getObjectType(data) {
|
|
45
44
|
var _b, _c;
|
|
46
45
|
const objectType = (_b = data.data) === null || _b === void 0 ? void 0 : _b.type;
|
|
47
|
-
// NOTE: should `Helpers.addLeadingZeroesToType`
|
|
46
|
+
// NOTE: should `Helpers.addLeadingZeroesToType` be used here ?
|
|
48
47
|
if (objectType)
|
|
49
|
-
return
|
|
48
|
+
return objectType;
|
|
50
49
|
throw new Error("no object type found on " + ((_c = data.data) === null || _c === void 0 ? void 0 : _c.objectId));
|
|
51
50
|
}
|
|
52
51
|
static getObjectId(data) {
|
|
@@ -371,35 +370,6 @@ Helpers.addTxObject = (tx, object) => {
|
|
|
371
370
|
// Query,
|
|
372
371
|
// };
|
|
373
372
|
// }
|
|
374
|
-
// =========================================================================
|
|
375
|
-
// Indexer Calculations
|
|
376
|
-
// =========================================================================
|
|
377
|
-
/**
|
|
378
|
-
* Calculates the total volume in USD.
|
|
379
|
-
*
|
|
380
|
-
* @param inputs - The input parameters for the calculation.
|
|
381
|
-
* @param inputs.volumes - Swap volumes.
|
|
382
|
-
* @param inputs.coinsToPrice - The mapping of coin types to their respective prices.
|
|
383
|
-
* @param inputs.coinsToDecimals - The mapping of coin types to their respective decimal places.
|
|
384
|
-
* @returns The total volume in USD.
|
|
385
|
-
*/
|
|
386
|
-
Helpers.calcIndexerVolumeUsd = (inputs) => {
|
|
387
|
-
const { volumes, coinsToPrice, coinsToDecimals } = inputs;
|
|
388
|
-
return volumes.reduce((acc, data) => {
|
|
389
|
-
const coinInPrice = coinsToPrice[data.coinTypeIn];
|
|
390
|
-
if (coinInPrice > 0) {
|
|
391
|
-
const decimals = coinsToDecimals[data.coinTypeIn];
|
|
392
|
-
const tradeAmount = __1.Coin.balanceWithDecimals(data.totalAmountIn, decimals);
|
|
393
|
-
const amountUsd = tradeAmount * coinInPrice;
|
|
394
|
-
return acc + amountUsd;
|
|
395
|
-
}
|
|
396
|
-
const coinOutPrice = coinsToPrice[data.coinTypeOut];
|
|
397
|
-
const decimals = coinsToDecimals[data.coinTypeOut];
|
|
398
|
-
const tradeAmount = __1.Coin.balanceWithDecimals(data.totalAmountOut, decimals);
|
|
399
|
-
const amountUsd = coinInPrice < 0 ? 0 : tradeAmount * coinOutPrice;
|
|
400
|
-
return acc + amountUsd;
|
|
401
|
-
}, 0);
|
|
402
|
-
};
|
|
403
373
|
Helpers.isValidSuiAddress = (address) => (0, utils_1.isValidSuiAddress)((() => {
|
|
404
374
|
if (!address.startsWith("0x") || address.length < 3)
|
|
405
375
|
return "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/general/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/general/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
|
|
@@ -16,4 +16,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./casting"), exports);
|
|
18
18
|
__exportStar(require("./helpers"), exports);
|
|
19
|
-
__exportStar(require("./indexerCaller"), exports);
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
2
2
|
import { AftermathApi } from "../../../general/providers/aftermathApi";
|
|
3
|
-
import { Balance,
|
|
3
|
+
import { Balance, CoinType, SuiAddress } from "../../../types";
|
|
4
4
|
import { CoinStruct } from "@mysten/sui/client";
|
|
5
5
|
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
6
6
|
export declare class CoinApi {
|
|
7
7
|
private readonly Provider;
|
|
8
8
|
constructor(Provider: AftermathApi);
|
|
9
|
-
fetchCoinMetadata: (inputs: {
|
|
10
|
-
coin: CoinType;
|
|
11
|
-
}) => Promise<CoinMetadaWithInfo>;
|
|
12
|
-
fetchCoinMetadatas: (inputs: {
|
|
13
|
-
coins: CoinType[];
|
|
14
|
-
}) => Promise<CoinMetadaWithInfo[]>;
|
|
15
|
-
fetchCoinsToDecimals: (...inputs: {
|
|
16
|
-
coins: CoinType[];
|
|
17
|
-
}[]) => Promise<CoinsToDecimals>;
|
|
18
9
|
fetchCoinWithAmountTx: (inputs: {
|
|
19
10
|
tx: Transaction | TransactionBlock;
|
|
20
11
|
walletAddress: SuiAddress;
|
|
@@ -33,8 +24,6 @@ export declare class CoinApi {
|
|
|
33
24
|
walletAddress: SuiAddress;
|
|
34
25
|
coinType: CoinType;
|
|
35
26
|
}) => Promise<CoinStruct[]>;
|
|
36
|
-
static formatCoinTypesForMoveCall: (coins: CoinType[]) => number[][];
|
|
37
|
-
private createLpCoinMetadata;
|
|
38
27
|
private static coinWithAmountTx;
|
|
39
28
|
}
|
|
40
29
|
//# sourceMappingURL=coinApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coinApi.d.ts","sourceRoot":"","sources":["../../../../src/packages/coin/api/coinApi.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"coinApi.d.ts","sourceRoot":"","sources":["../../../../src/packages/coin/api/coinApi.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,WAAW,EACX,yBAAyB,EACzB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAY,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,EAAE,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,qBAAa,OAAO;IAKP,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,YAAY;IAM5C,qBAAqB,WAAkB;QAC7C,EAAE,EAAE,WAAW,GAAG,gBAAgB,CAAC;QACnC,aAAa,EAAE,UAAU,CAAC;QAC1B,QAAQ,EAAE,QAAQ,CAAC;QACnB,UAAU,EAAE,OAAO,CAAC;QACpB,aAAa,CAAC,EAAE,OAAO,CAAC;KACxB,KAAG,QAAQ,yBAAyB,CAAC,CAcpC;IAEK,sBAAsB,WAAkB;QAC9C,EAAE,EAAE,WAAW,CAAC;QAChB,aAAa,EAAE,UAAU,CAAC;QAC1B,SAAS,EAAE,QAAQ,EAAE,CAAC;QACtB,WAAW,EAAE,OAAO,EAAE,CAAC;QACvB,aAAa,CAAC,EAAE,OAAO,CAAC;KACxB,KAAG,QAAQ,yBAAyB,EAAE,CAAC,CA8BtC;IAGK,aAAa,WAAkB;QACrC,aAAa,EAAE,UAAU,CAAC;QAC1B,QAAQ,EAAE,QAAQ,CAAC;KAEnB,KAAG,QAAQ,UAAU,EAAE,CAAC,CAiCvB;IAMF,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAsE7B;CACF"}
|
|
@@ -12,8 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.CoinApi = void 0;
|
|
13
13
|
const coin_1 = require("../coin");
|
|
14
14
|
const helpers_1 = require("../../../general/utils/helpers");
|
|
15
|
-
const pools_1 = require("../../pools/pools");
|
|
16
|
-
const utils_1 = require("../../../general/utils");
|
|
17
15
|
const transactionsApiHelpers_1 = require("../../../general/apiHelpers/transactionsApiHelpers");
|
|
18
16
|
class CoinApi {
|
|
19
17
|
// =========================================================================
|
|
@@ -22,76 +20,6 @@ class CoinApi {
|
|
|
22
20
|
constructor(Provider) {
|
|
23
21
|
this.Provider = Provider;
|
|
24
22
|
// =========================================================================
|
|
25
|
-
// Inspections
|
|
26
|
-
// =========================================================================
|
|
27
|
-
this.fetchCoinMetadata = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
const { coin } = inputs;
|
|
29
|
-
const [metadata] = yield this.fetchCoinMetadatas({ coins: [coin] });
|
|
30
|
-
return metadata;
|
|
31
|
-
});
|
|
32
|
-
this.fetchCoinMetadatas = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
const { coins } = inputs;
|
|
34
|
-
const response = yield this.Provider.indexerCaller.fetchIndexer("coins/metadata", {
|
|
35
|
-
coin_types: coins.map((coin) => helpers_1.Helpers.addLeadingZeroesToType(coin)),
|
|
36
|
-
}, undefined, undefined, undefined, true);
|
|
37
|
-
return Promise.all(response.coin_metadata.map((metadata, index) => {
|
|
38
|
-
try {
|
|
39
|
-
if (metadata[0] === null)
|
|
40
|
-
throw new Error("coin metadata is null");
|
|
41
|
-
return {
|
|
42
|
-
decimals: metadata[0].decimals,
|
|
43
|
-
description: metadata[0].description,
|
|
44
|
-
iconUrl: metadata[0].icon_url,
|
|
45
|
-
id: metadata[0].id,
|
|
46
|
-
name: metadata[0].name,
|
|
47
|
-
symbol: metadata[0].symbol,
|
|
48
|
-
isGenerated: false,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
try {
|
|
53
|
-
return this.createLpCoinMetadata({
|
|
54
|
-
lpCoinType: coins[index],
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
catch (e) { }
|
|
58
|
-
const maxSymbolLength = 10;
|
|
59
|
-
const maxPackageNameLength = 24;
|
|
60
|
-
const coinClass = new coin_1.Coin(coins[index]);
|
|
61
|
-
const symbol = coinClass.coinTypeSymbol
|
|
62
|
-
.toUpperCase()
|
|
63
|
-
.slice(0, maxSymbolLength);
|
|
64
|
-
const packageName = coinClass.coinTypePackageName.slice(0, maxPackageNameLength);
|
|
65
|
-
return {
|
|
66
|
-
symbol,
|
|
67
|
-
id: null,
|
|
68
|
-
description: `${symbol} (${packageName})`,
|
|
69
|
-
name: symbol
|
|
70
|
-
.split("_")
|
|
71
|
-
.map((word) => helpers_1.Helpers.capitalizeOnlyFirstLetter(word))
|
|
72
|
-
.join(" "),
|
|
73
|
-
decimals: 9,
|
|
74
|
-
iconUrl: null,
|
|
75
|
-
isGenerated: true,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
}));
|
|
79
|
-
});
|
|
80
|
-
this.fetchCoinsToDecimals = this.Provider.withCache({
|
|
81
|
-
key: "fetchCoinsToDecimals",
|
|
82
|
-
expirationSeconds: -1,
|
|
83
|
-
callback: (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
const { coins } = inputs;
|
|
85
|
-
const allDecimals = yield Promise.all(coins.map((coin) => __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
return (yield this.fetchCoinMetadata({ coin })).decimals;
|
|
87
|
-
})));
|
|
88
|
-
const coinsToDecimals = allDecimals.reduce((acc, decimals, index) => {
|
|
89
|
-
return Object.assign(Object.assign({}, acc), { [coins[index]]: decimals });
|
|
90
|
-
}, {});
|
|
91
|
-
return coinsToDecimals;
|
|
92
|
-
}),
|
|
93
|
-
});
|
|
94
|
-
// =========================================================================
|
|
95
23
|
// Transaction Builders
|
|
96
24
|
// =========================================================================
|
|
97
25
|
this.fetchCoinWithAmountTx = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -149,61 +77,10 @@ class CoinApi {
|
|
|
149
77
|
cursor = paginatedCoins.nextCursor;
|
|
150
78
|
} while (true);
|
|
151
79
|
});
|
|
152
|
-
// =========================================================================
|
|
153
|
-
// Private Methods
|
|
154
|
-
// =========================================================================
|
|
155
|
-
// =========================================================================
|
|
156
|
-
// Helpers
|
|
157
|
-
// =========================================================================
|
|
158
|
-
// NOTE: this is temporary until LP coin metadata issue is solved on Sui
|
|
159
|
-
this.createLpCoinMetadata = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
160
|
-
try {
|
|
161
|
-
const PoolsApi = this.Provider.Pools();
|
|
162
|
-
const poolObjectId = yield PoolsApi.fetchPoolObjectIdForLpCoinType(inputs);
|
|
163
|
-
if (!poolObjectId)
|
|
164
|
-
throw new Error("invalid lp coin type");
|
|
165
|
-
const pool = yield PoolsApi.fetchPool({ objectId: poolObjectId });
|
|
166
|
-
const coinSymbols = Object.keys(pool.coins).map((coin) => new coin_1.Coin(coin).coinTypeSymbol);
|
|
167
|
-
// const coinSymbols = (
|
|
168
|
-
// await Promise.all(
|
|
169
|
-
// Object.keys(pool.coins).map((coin) =>
|
|
170
|
-
// this.Provider.Coin().fetchCoinMetadata({
|
|
171
|
-
// coin,
|
|
172
|
-
// })
|
|
173
|
-
// )
|
|
174
|
-
// )
|
|
175
|
-
// ).map((metadata) => metadata.symbol);
|
|
176
|
-
const coinsString = `${coinSymbols.reduce((acc, symbol, index) => acc + symbol + (index >= coinSymbols.length - 1 ? "" : "/"), "")}`;
|
|
177
|
-
return {
|
|
178
|
-
symbol: `${coinsString} afLP`,
|
|
179
|
-
id: null,
|
|
180
|
-
description: `Aftermath LP Coin for ${coinsString} Pool`,
|
|
181
|
-
name: `${coinsString} LP`,
|
|
182
|
-
decimals: pool.lpCoinDecimals,
|
|
183
|
-
iconUrl: null,
|
|
184
|
-
isGenerated: true,
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
catch (e) {
|
|
188
|
-
return {
|
|
189
|
-
symbol: "afLP",
|
|
190
|
-
id: null,
|
|
191
|
-
description: "Aftermath Finance LP",
|
|
192
|
-
name: "LP",
|
|
193
|
-
decimals: pools_1.Pools.constants.defaults.lpCoinDecimals,
|
|
194
|
-
iconUrl: null,
|
|
195
|
-
isGenerated: true,
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
80
|
}
|
|
200
81
|
}
|
|
201
82
|
exports.CoinApi = CoinApi;
|
|
202
83
|
// =========================================================================
|
|
203
|
-
// Helpers
|
|
204
|
-
// =========================================================================
|
|
205
|
-
CoinApi.formatCoinTypesForMoveCall = (coins) => coins.map((coin) => utils_1.Casting.u8VectorFromString(coin.slice(2))); // slice to remove 0x
|
|
206
|
-
// =========================================================================
|
|
207
84
|
// Private Static Methods
|
|
208
85
|
// =========================================================================
|
|
209
86
|
CoinApi.coinWithAmountTx = (inputs) => {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { AftermathApi } from "../../../general/providers";
|
|
2
|
-
import {
|
|
3
|
-
import { AnyObjectType, Balance, DcaAddresses, SuiAddress } from "../../../types";
|
|
4
|
-
import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
2
|
+
import { AnyObjectType, DcaAddresses } from "../../../types";
|
|
5
3
|
export declare class DcaApi {
|
|
6
4
|
private readonly Provider;
|
|
7
5
|
private static readonly constants;
|
|
@@ -12,31 +10,6 @@ export declare class DcaApi {
|
|
|
12
10
|
executedTrade: AnyObjectType;
|
|
13
11
|
};
|
|
14
12
|
constructor(Provider: AftermathApi);
|
|
15
|
-
fetchBuildCreateOrderTx: (inputs: ApiDcaTransactionForCreateOrderBody) => Promise<Transaction>;
|
|
16
|
-
createNewOrderTx: (inputs: {
|
|
17
|
-
tx: Transaction;
|
|
18
|
-
inputCoinTxArg: TransactionObjectArgument;
|
|
19
|
-
gasCoinTxArg: TransactionObjectArgument;
|
|
20
|
-
recipientAddress: SuiAddress;
|
|
21
|
-
orderAmountPerTrade: Balance;
|
|
22
|
-
} & ApiDcaTransactionForCreateOrderBody) => Promise<Transaction>;
|
|
23
|
-
fetchCloseDcaOrder: (inputs: ApiDcaTransactionForCloseOrderBody) => Promise<boolean>;
|
|
24
|
-
fetchUserPublicKey: (inputs: ApiDCAsOwnedBody) => Promise<string | undefined>;
|
|
25
|
-
fetchCreateUserPublicKey: (inputs: ApiDcaCreateUserBody) => Promise<boolean>;
|
|
26
|
-
fetchAllOrdersObjects: (inputs: {
|
|
27
|
-
walletAddress: SuiAddress;
|
|
28
|
-
}) => Promise<DcaOrdersObject>;
|
|
29
|
-
fetchActiveOrdersObjects: (inputs: {
|
|
30
|
-
walletAddress: SuiAddress;
|
|
31
|
-
}) => Promise<DcaOrderObject[]>;
|
|
32
|
-
fetchPastOrdersObjects: (inputs: {
|
|
33
|
-
walletAddress: SuiAddress;
|
|
34
|
-
}) => Promise<DcaOrderObject[]>;
|
|
35
|
-
fetchOrdersObjectsByType: (inputs: {
|
|
36
|
-
walletAddress: SuiAddress;
|
|
37
|
-
type: "active" | "past";
|
|
38
|
-
}) => Promise<DcaOrderObject[]>;
|
|
39
|
-
private getRate;
|
|
40
13
|
private createdOrderEventType;
|
|
41
14
|
private closedOrderEventType;
|
|
42
15
|
private executedOrderEventType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dcaApi.d.ts","sourceRoot":"","sources":["../../../../src/packages/dca/api/dcaApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"dcaApi.d.ts","sourceRoot":"","sources":["../../../../src/packages/dca/api/dcaApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG7D,qBAAa,MAAM;IAiCN,OAAO,CAAC,QAAQ,CAAC,QAAQ;IA5BrC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAW/B;IAMF,SAAgB,SAAS,EAAE,YAAY,CAAC;IACxC,SAAgB,UAAU,EAAE;QAC3B,YAAY,EAAE,aAAa,CAAC;QAC5B,WAAW,EAAE,aAAa,CAAC;QAC3B,aAAa,EAAE,aAAa,CAAC;KAC7B,CAAC;gBAM2B,QAAQ,EAAE,YAAY;IAmBnD,OAAO,CAAC,qBAAqB,CAK1B;IAEH,OAAO,CAAC,oBAAoB,CAKzB;IAEH,OAAO,CAAC,sBAAsB,CAK3B;CACH"}
|
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.DcaApi = void 0;
|
|
13
|
-
const utils_1 = require("../../../general/utils");
|
|
14
|
-
const coin_1 = require("../../coin");
|
|
15
|
-
const transactions_1 = require("@mysten/sui/transactions");
|
|
16
4
|
const eventsApiHelpers_1 = require("../../../general/apiHelpers/eventsApiHelpers");
|
|
17
|
-
const transactionsApiHelpers_1 = require("../../../general/apiHelpers/transactionsApiHelpers");
|
|
18
|
-
const dca_1 = require("../dca");
|
|
19
5
|
class DcaApi {
|
|
20
6
|
// =========================================================================
|
|
21
7
|
// Constructor
|
|
@@ -23,164 +9,6 @@ class DcaApi {
|
|
|
23
9
|
constructor(Provider) {
|
|
24
10
|
this.Provider = Provider;
|
|
25
11
|
// =========================================================================
|
|
26
|
-
// Public Transaction Methods
|
|
27
|
-
// =========================================================================
|
|
28
|
-
this.fetchBuildCreateOrderTx = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
const { walletAddress } = inputs;
|
|
30
|
-
const tx = new transactions_1.Transaction();
|
|
31
|
-
tx.setSender(walletAddress);
|
|
32
|
-
const tradesGasAmount = BigInt(inputs.tradesAmount) * dca_1.Dca.constants.gasAmount;
|
|
33
|
-
const orderAmountPerTrade = inputs.allocateCoinAmount / BigInt(inputs.tradesAmount);
|
|
34
|
-
const recipientAddress = inputs.customRecipient
|
|
35
|
-
? inputs.customRecipient
|
|
36
|
-
: walletAddress;
|
|
37
|
-
const [gasCoinTxArg, inputCoinTxArg] = yield Promise.all([
|
|
38
|
-
this.Provider.Coin().fetchCoinWithAmountTx({
|
|
39
|
-
tx,
|
|
40
|
-
walletAddress,
|
|
41
|
-
coinType: coin_1.Coin.constants.suiCoinType,
|
|
42
|
-
coinAmount: tradesGasAmount,
|
|
43
|
-
isSponsoredTx: inputs.isSponsoredTx,
|
|
44
|
-
}),
|
|
45
|
-
this.Provider.Coin().fetchCoinWithAmountTx({
|
|
46
|
-
tx,
|
|
47
|
-
walletAddress,
|
|
48
|
-
coinType: inputs.allocateCoinType,
|
|
49
|
-
coinAmount: inputs.allocateCoinAmount,
|
|
50
|
-
isSponsoredTx: inputs.isSponsoredTx,
|
|
51
|
-
}),
|
|
52
|
-
]);
|
|
53
|
-
const resultTx = yield this.createNewOrderTx(Object.assign(Object.assign({}, inputs), { tx,
|
|
54
|
-
gasCoinTxArg,
|
|
55
|
-
inputCoinTxArg,
|
|
56
|
-
orderAmountPerTrade,
|
|
57
|
-
recipientAddress }));
|
|
58
|
-
return resultTx;
|
|
59
|
-
});
|
|
60
|
-
// =========================================================================
|
|
61
|
-
// Transaction Commands
|
|
62
|
-
// =========================================================================
|
|
63
|
-
this.createNewOrderTx = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
var _a, _b, _c, _d, _e;
|
|
65
|
-
const initTx = (_a = inputs.tx) !== null && _a !== void 0 ? _a : new transactions_1.Transaction();
|
|
66
|
-
const txBytes = yield initTx.build({
|
|
67
|
-
client: this.Provider.provider,
|
|
68
|
-
onlyTransactionKind: true,
|
|
69
|
-
});
|
|
70
|
-
const b64TxBytes = Buffer.from(txBytes).toString("base64");
|
|
71
|
-
const { tx_data } = yield this.Provider.indexerCaller.fetchIndexer("dca/create", {
|
|
72
|
-
tx_kind: b64TxBytes,
|
|
73
|
-
order: {
|
|
74
|
-
input_coin: utils_1.Helpers.transactions.serviceCoinDataFromCoinTxArg({
|
|
75
|
-
coinTxArg: inputs.inputCoinTxArg,
|
|
76
|
-
}),
|
|
77
|
-
input_coin_type: inputs.allocateCoinType,
|
|
78
|
-
output_coin_type: inputs.buyCoinType,
|
|
79
|
-
gas_coin: utils_1.Helpers.transactions.serviceCoinDataFromCoinTxArg({
|
|
80
|
-
coinTxArg: inputs.gasCoinTxArg,
|
|
81
|
-
}),
|
|
82
|
-
owner: inputs.walletAddress,
|
|
83
|
-
recipient: inputs.recipientAddress,
|
|
84
|
-
frequency_ms: inputs.frequencyMs.toString(),
|
|
85
|
-
delay_timestamp_ms: inputs.delayTimeMs.toString(),
|
|
86
|
-
amount_per_trade: inputs.orderAmountPerTrade.toString(),
|
|
87
|
-
max_allowable_slippage_bps: inputs.maxAllowableSlippageBps,
|
|
88
|
-
min_amount_out: ((_c = (_b = inputs.strategy) === null || _b === void 0 ? void 0 : _b.minPrice) !== null && _c !== void 0 ? _c : 0)
|
|
89
|
-
.toString()
|
|
90
|
-
.replace("n", ""),
|
|
91
|
-
max_amount_out: ((_e = (_d = inputs.strategy) === null || _d === void 0 ? void 0 : _d.maxPrice) !== null && _e !== void 0 ? _e : utils_1.Casting.u64MaxBigInt)
|
|
92
|
-
.toString()
|
|
93
|
-
.replace("n", ""),
|
|
94
|
-
number_of_trades: Number(inputs.tradesAmount),
|
|
95
|
-
},
|
|
96
|
-
}, undefined, undefined, undefined, true);
|
|
97
|
-
const tx = transactions_1.Transaction.fromKind(tx_data);
|
|
98
|
-
transactionsApiHelpers_1.TransactionsApiHelpers.transferTxMetadata({
|
|
99
|
-
initTx,
|
|
100
|
-
newTx: tx,
|
|
101
|
-
});
|
|
102
|
-
return tx;
|
|
103
|
-
});
|
|
104
|
-
// =========================================================================
|
|
105
|
-
// Inspections
|
|
106
|
-
// =========================================================================
|
|
107
|
-
this.fetchCloseDcaOrder = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
return this.Provider.indexerCaller.fetchIndexer(`dca/cancel`, {
|
|
109
|
-
wallet_address: inputs.walletAddress,
|
|
110
|
-
signature: inputs.signature,
|
|
111
|
-
bytes: inputs.bytes,
|
|
112
|
-
}, undefined, undefined, undefined, true);
|
|
113
|
-
});
|
|
114
|
-
// =========================================================================
|
|
115
|
-
// User Public Key
|
|
116
|
-
// =========================================================================
|
|
117
|
-
this.fetchUserPublicKey = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
118
|
-
const data = yield this.Provider.indexerCaller.fetchIndexer(`dca/user/get`, {
|
|
119
|
-
wallet_address: inputs.walletAddress,
|
|
120
|
-
}, undefined, undefined, undefined, true);
|
|
121
|
-
return data.public_key;
|
|
122
|
-
});
|
|
123
|
-
this.fetchCreateUserPublicKey = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
124
|
-
return this.Provider.indexerCaller.fetchIndexer(`dca/user/add`, {
|
|
125
|
-
wallet_address: inputs.walletAddress,
|
|
126
|
-
signature: inputs.signature,
|
|
127
|
-
bytes: inputs.bytes,
|
|
128
|
-
}, undefined, undefined, undefined, true);
|
|
129
|
-
});
|
|
130
|
-
// =========================================================================
|
|
131
|
-
// Class Objects
|
|
132
|
-
// =========================================================================
|
|
133
|
-
this.fetchAllOrdersObjects = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
134
|
-
const [activeOrders = [], pastOrders = []] = yield Promise.all([
|
|
135
|
-
this.fetchActiveOrdersObjects(inputs),
|
|
136
|
-
this.fetchPastOrdersObjects(inputs),
|
|
137
|
-
]);
|
|
138
|
-
return {
|
|
139
|
-
active: activeOrders,
|
|
140
|
-
past: pastOrders,
|
|
141
|
-
};
|
|
142
|
-
});
|
|
143
|
-
this.fetchActiveOrdersObjects = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
144
|
-
return this.fetchOrdersObjectsByType(Object.assign(Object.assign({}, inputs), { type: "active" }));
|
|
145
|
-
});
|
|
146
|
-
this.fetchPastOrdersObjects = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
return this.fetchOrdersObjectsByType(Object.assign(Object.assign({}, inputs), { type: "past" }));
|
|
148
|
-
});
|
|
149
|
-
this.fetchOrdersObjectsByType = (inputs) => __awaiter(this, void 0, void 0, function* () {
|
|
150
|
-
const { type, walletAddress } = inputs;
|
|
151
|
-
const uncastedResponse = yield this.Provider.indexerCaller.fetchIndexer(`dca/get/${type}`, {
|
|
152
|
-
sender: walletAddress,
|
|
153
|
-
}, undefined, undefined, undefined, true);
|
|
154
|
-
const orders = uncastedResponse.orders
|
|
155
|
-
.sort((lhs, rhs) => rhs.created.timestamp - lhs.created.timestamp)
|
|
156
|
-
.map((order) => utils_1.Casting.dca.createdOrderEventOnIndexer(order));
|
|
157
|
-
const preparedOrders = yield Promise.all(orders.map((order) => __awaiter(this, void 0, void 0, function* () {
|
|
158
|
-
const preparedTrades = yield Promise.all(order.trades.map((trade) => __awaiter(this, void 0, void 0, function* () {
|
|
159
|
-
const rate = yield this.getRate(trade);
|
|
160
|
-
return Object.assign(Object.assign({}, trade), { rate });
|
|
161
|
-
})));
|
|
162
|
-
return Object.assign(Object.assign({}, order), { trades: preparedTrades });
|
|
163
|
-
})));
|
|
164
|
-
return preparedOrders;
|
|
165
|
-
});
|
|
166
|
-
this.getRate = (trade) => __awaiter(this, void 0, void 0, function* () {
|
|
167
|
-
const allocatedCoinType = utils_1.Helpers.addLeadingZeroesToType(trade.allocatedCoin.coin);
|
|
168
|
-
const buyCoinType = utils_1.Helpers.addLeadingZeroesToType(trade.buyCoin.coin);
|
|
169
|
-
const [allocateCoinDecimals, buyCoinDecimals] = yield Promise.all([
|
|
170
|
-
(yield this.Provider.Coin().fetchCoinMetadata({
|
|
171
|
-
coin: allocatedCoinType,
|
|
172
|
-
})).decimals,
|
|
173
|
-
(yield this.Provider.Coin().fetchCoinMetadata({
|
|
174
|
-
coin: buyCoinType,
|
|
175
|
-
})).decimals,
|
|
176
|
-
]);
|
|
177
|
-
const allocatedBalance = coin_1.Coin.balanceWithDecimals(trade.allocatedCoin.amount, allocateCoinDecimals);
|
|
178
|
-
const buyBalance = coin_1.Coin.balanceWithDecimals(trade.buyCoin.amount, buyCoinDecimals);
|
|
179
|
-
return allocatedBalance !== 0
|
|
180
|
-
? buyBalance / allocatedBalance
|
|
181
|
-
: undefined;
|
|
182
|
-
});
|
|
183
|
-
// =========================================================================
|
|
184
12
|
// Events
|
|
185
13
|
// =========================================================================
|
|
186
14
|
this.createdOrderEventType = () => eventsApiHelpers_1.EventsApiHelpers.createEventType(this.addresses.packages.dca, DcaApi.constants.moduleNames.events, DcaApi.constants.eventNames.createdOrder);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AftermathApi } from "../../../general/providers/aftermathApi";
|
|
2
|
-
import { AnyObjectType, FarmsAddresses, Timestamp, CoinType, ApiFarmsStakeBody, ApiHarvestFarmsRewardsBody, ApiFarmsDepositPrincipalBody, Balance, ApiFarmsUnstakeBody, FarmsLockEnforcement, FarmsMultiplier, ApiFarmsCreateStakingPoolBody,
|
|
2
|
+
import { AnyObjectType, FarmsAddresses, Timestamp, CoinType, ApiFarmsStakeBody, ApiHarvestFarmsRewardsBody, ApiFarmsDepositPrincipalBody, Balance, ApiFarmsUnstakeBody, FarmsLockEnforcement, FarmsMultiplier, ApiFarmsCreateStakingPoolBody, ApiFarmsTopUpStakingPoolRewardsBody, ApiFarmsInitializeStakingPoolRewardBody, StakingPoolOwnerCapObject, ApiFarmsOwnedStakingPoolOwnerCapsBody, ApiFarmsIncreaseStakingPoolRewardsEmissionsBody, PartialFarmsStakedPositionObject, EventsInputs, FarmsStakedEvent, FarmsStakedRelaxedEvent, FarmsLockedEvent, FarmsUnlockedEvent, FarmsWithdrewPrincipalEvent, FarmsDepositedPrincipalEvent, FarmsHarvestedRewardsEvent, FarmsCreatedVaultEvent, StakingPoolOneTimeAdminCapObject, FarmOwnerOrOneTimeAdminCap, ObjectId, SuiAddress } from "../../../types";
|
|
3
3
|
import { TransactionArgument, Transaction } from "@mysten/sui/transactions";
|
|
4
4
|
import { MoveErrors, MoveErrorsInterface } from "../../../general/types/moveErrorsInterface";
|
|
5
5
|
export declare class FarmsApi implements MoveErrorsInterface {
|
|
@@ -26,13 +26,6 @@ export declare class FarmsApi implements MoveErrorsInterface {
|
|
|
26
26
|
};
|
|
27
27
|
readonly moveErrors: MoveErrors;
|
|
28
28
|
constructor(Provider: AftermathApi);
|
|
29
|
-
fetchStakingPool: (inputs: {
|
|
30
|
-
objectId: ObjectId;
|
|
31
|
-
}) => Promise<FarmsStakingPoolObject>;
|
|
32
|
-
fetchStakingPools: (inputs: {
|
|
33
|
-
objectIds: ObjectId[];
|
|
34
|
-
}) => Promise<FarmsStakingPoolObject[]>;
|
|
35
|
-
fetchAllStakingPools: () => Promise<FarmsStakingPoolObject[]>;
|
|
36
29
|
fetchOwnedStakingPoolOwnerCaps: (inputs: ApiFarmsOwnedStakingPoolOwnerCapsBody) => Promise<StakingPoolOwnerCapObject[]>;
|
|
37
30
|
fetchOwnedStakingPoolOneTimeAdminCaps: (inputs: ApiFarmsOwnedStakingPoolOwnerCapsBody) => Promise<StakingPoolOneTimeAdminCapObject[]>;
|
|
38
31
|
fetchOwnedPartialStakedPositions: (inputs: {
|
|
@@ -232,22 +225,6 @@ export declare class FarmsApi implements MoveErrorsInterface {
|
|
|
232
225
|
recipientAddress: SuiAddress;
|
|
233
226
|
rewardCoinType: CoinType;
|
|
234
227
|
}, "tx">) => Transaction;
|
|
235
|
-
fetchIsStakingPoolUnlocked(inputs: {
|
|
236
|
-
stakingPoolId: ObjectId;
|
|
237
|
-
stakeCoinType: CoinType;
|
|
238
|
-
}): Promise<boolean>;
|
|
239
|
-
fetchStakingPoolRemainingRewards(inputs: {
|
|
240
|
-
stakingPoolId: ObjectId;
|
|
241
|
-
stakeCoinType: CoinType;
|
|
242
|
-
}): Promise<Balance[]>;
|
|
243
|
-
fetchIsUnlockedForStakingPools(inputs: {
|
|
244
|
-
stakingPoolIds: ObjectId[];
|
|
245
|
-
stakeCoinTypes: CoinType[];
|
|
246
|
-
}): Promise<boolean[]>;
|
|
247
|
-
fetchRemainingRewardsForStakingPools(inputs: {
|
|
248
|
-
stakingPoolIds: ObjectId[];
|
|
249
|
-
stakeCoinTypes: CoinType[];
|
|
250
|
-
}): Promise<Balance[][]>;
|
|
251
228
|
private createdVaultEventType;
|
|
252
229
|
private initializedRewardEventType;
|
|
253
230
|
private addedRewardEventType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"farmsApi.d.ts","sourceRoot":"","sources":["../../../../src/packages/farms/api/farmsApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EACN,aAAa,EACb,cAAc,EACd,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,0BAA0B,EAC1B,4BAA4B,EAC5B,OAAO,EACP,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,6BAA6B,
|
|
1
|
+
{"version":3,"file":"farmsApi.d.ts","sourceRoot":"","sources":["../../../../src/packages/farms/api/farmsApi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