@affluent-org/sdk 0.0.2 → 0.0.3
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/build/Account.compiled.json +1 -0
- package/dist/build/Receipt.compiled.json +1 -0
- package/dist/build/WTONWallet.compiled.json +1 -0
- package/dist/common/cache.d.ts +16 -0
- package/dist/common/cache.js +96 -0
- package/dist/common/service.d.ts +20 -0
- package/dist/common/service.js +69 -0
- package/dist/common/type.d.ts +14 -0
- package/dist/common/type.js +2 -0
- package/dist/common/unknown-contract.d.ts +14 -0
- package/dist/common/unknown-contract.js +18 -0
- package/dist/common/versions.d.ts +14 -0
- package/dist/common/versions.js +22 -0
- package/dist/constants/pool.d.ts +1 -0
- package/dist/constants/pool.js +2 -0
- package/dist/contracts/_mock/simple-oracle.d.ts +34 -0
- package/dist/contracts/_mock/simple-oracle.js +73 -0
- package/dist/contracts/vault/share-vault/type.d.ts +30 -0
- package/dist/contracts/vault/share-vault/type.js +2 -0
- package/dist/contracts/vault/strategy-vault/utils.d.ts +6 -0
- package/dist/contracts/vault/strategy-vault/utils.js +32 -0
- package/dist/factorial.d.ts +14 -0
- package/dist/factorial.js +20 -0
- package/dist/farm.d.ts +92 -0
- package/dist/farm.js +209 -0
- package/dist/monitor.d.ts +57 -0
- package/dist/monitor.js +527 -0
- package/dist/monitorCacheV1.d.ts +52 -0
- package/dist/monitorCacheV1.js +504 -0
- package/dist/oracle/oracle-v2.d.ts +39 -0
- package/dist/oracle/oracle-v2.js +151 -0
- package/dist/oracle/oracle.d.ts +107 -0
- package/dist/oracle/oracle.js +392 -0
- package/dist/periphery.d.ts +259 -0
- package/dist/periphery.js +1087 -0
- package/dist/pool.d.ts +216 -0
- package/dist/pool.js +2298 -0
- package/dist/poolCacheV1.d.ts +139 -0
- package/dist/poolCacheV1.js +1841 -0
- package/dist/rfq-auction.d.ts +75 -0
- package/dist/rfq-auction.js +220 -0
- package/dist/rfq-batch.d.ts +112 -0
- package/dist/rfq-batch.js +284 -0
- package/dist/services/share-vault/computation.d.ts +14 -17
- package/dist/services/share-vault/computation.js +39 -0
- package/dist/services/share-vault/index.js +6 -3
- package/dist/services/share-vault/query.d.ts +38 -8
- package/dist/services/share-vault/query.js +20 -27
- package/dist/services/share-vault/type.d.ts +19 -0
- package/dist/services/share-vault/type.js +2 -0
- package/dist/services/share-vault/user/index.js +3 -1
- package/dist/services/strategy-vault/computation.d.ts +1 -0
- package/dist/services/strategy-vault/computation.js +15 -0
- package/dist/services/strategy-vault/query.d.ts +147 -0
- package/dist/services/strategy-vault/query.js +67 -0
- package/dist/services/strategy-vault/type.d.ts +2 -0
- package/dist/services/strategy-vault/type.js +2 -0
- package/dist/share-vault.d.ts +91 -0
- package/dist/share-vault.js +747 -0
- package/dist/stonfi.d.ts +18 -0
- package/dist/stonfi.js +76 -0
- package/dist/strategy_vault/base.d.ts +399 -0
- package/dist/strategy_vault/base.js +1199 -0
- package/dist/strategy_vault/index.d.ts +3 -0
- package/dist/strategy_vault/index.js +7 -0
- package/dist/strategy_vault/steps.d.ts +49 -0
- package/dist/strategy_vault/steps.js +170 -0
- package/dist/types/action.d.ts +55 -0
- package/dist/types/action.js +2 -0
- package/dist/types/messages.d.ts +7 -0
- package/dist/types/messages.js +2 -0
- package/dist/types/params.d.ts +19 -0
- package/dist/types/params.js +2 -0
- package/dist/types/pool.d.ts +83 -0
- package/dist/types/pool.js +2 -0
- package/dist/types/transaction.d.ts +40 -0
- package/dist/types/transaction.js +2 -0
- package/dist/utils/_parse_temp/JumpIRM.d.ts +37 -0
- package/dist/utils/_parse_temp/JumpIRM.js +71 -0
- package/dist/utils/_parse_temp/Pool.d.ts +559 -0
- package/dist/utils/_parse_temp/Pool.js +1023 -0
- package/dist/utils/_parse_temp/ShareVault.d.ts +264 -0
- package/dist/utils/_parse_temp/ShareVault.js +479 -0
- package/dist/utils/_parse_temp/StrategyVault.d.ts +729 -0
- package/dist/utils/_parse_temp/StrategyVault.js +1865 -0
- package/dist/utils/_parse_temp/parseMsgBody.d.ts +13 -0
- package/dist/utils/_parse_temp/parseMsgBody.js +313 -0
- package/dist/utils/assert.d.ts +1 -0
- package/dist/utils/assert.js +9 -0
- package/dist/utils/client-for-parameter.d.ts +12 -0
- package/dist/utils/client-for-parameter.js +97 -0
- package/dist/utils/oracle/index.d.ts +4 -0
- package/dist/utils/oracle/index.js +19 -0
- package/dist/utils/oracle/redstone/helper.d.ts +22 -0
- package/dist/utils/oracle/redstone/helper.js +186 -0
- package/dist/utils/tracer.d.ts +13 -0
- package/dist/utils/tracer.js +137 -0
- package/dist/utils/tracker/index.d.ts +5 -0
- package/dist/utils/tracker/index.js +118 -0
- package/dist/utils/tracker/query-id-generactor.d.ts +2 -0
- package/dist/utils/tracker/query-id-generactor.js +12 -0
- package/dist/utils/tracker/type.d.ts +34 -0
- package/dist/utils/tracker/type.js +2 -0
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ import { AddressInput, AddressLike } from "../../contracts/common/type";
|
|
|
4
4
|
import { JettonWallet } from "../../contracts/jetton/jetton-wallet";
|
|
5
5
|
import { RFQAuction } from "../../contracts/rfq/rfq_auction";
|
|
6
6
|
import { StrategyVault } from "../../contracts/vault/strategy-vault";
|
|
7
|
+
import { PoolState } from "../../contracts/core/pool/type";
|
|
7
8
|
export declare function getVault(ctx: AffluentContext, strategyVaultAddress: AddressInput): OpenedContract<StrategyVault>;
|
|
8
9
|
export declare function getVaultData(ctx: AffluentContext, strategyVaultAddress: AddressLike): Promise<{
|
|
9
10
|
globalDepositValueCap: bigint;
|
|
@@ -136,3 +137,149 @@ export declare function splitPureAndVaultAsset(ctx: AffluentContext, addresses:
|
|
|
136
137
|
vaultAssetAddresses: string[];
|
|
137
138
|
pureAssetAddresses: string[];
|
|
138
139
|
}>;
|
|
140
|
+
export declare function getPoolInfoForStrategyVault(ctx: AffluentContext, strategyVaultAddress: AddressInput): Promise<Record<string, PoolState>>;
|
|
141
|
+
export declare function getPoolPositionsForStrategyVault(ctx: AffluentContext, strategyVaultAddress: AddressInput): Promise<Record<string, Record<string, {
|
|
142
|
+
supplyShare: bigint;
|
|
143
|
+
supplyAmount: bigint;
|
|
144
|
+
borrowShare: bigint;
|
|
145
|
+
borrowAmount: bigint;
|
|
146
|
+
}>>>;
|
|
147
|
+
export declare function getValuationContext(ctx: AffluentContext, strategyVaultAddress: AddressInput): Promise<{
|
|
148
|
+
storage: {
|
|
149
|
+
globalDepositValueCap: bigint;
|
|
150
|
+
withdrawFeeRate: number;
|
|
151
|
+
queueWithdrawFeeRate: number;
|
|
152
|
+
depositQueueManager: import("../../contracts/vault/strategy-vault").QueueManager;
|
|
153
|
+
withdrawQueueManager: import("../../contracts/vault/strategy-vault").QueueManager;
|
|
154
|
+
interactiveVaultDict: Record<string, import("../../contracts/vault/strategy-vault").InteractiveVaultConfigItem>;
|
|
155
|
+
xchainConnectorAddress: Address | null;
|
|
156
|
+
xchainConfig: Record<string, {
|
|
157
|
+
connected: boolean;
|
|
158
|
+
xchainAccountAddress: bigint;
|
|
159
|
+
oftConfig: Map<string, {
|
|
160
|
+
destinationAddress: Address;
|
|
161
|
+
forwardGas: bigint;
|
|
162
|
+
forwardPayload?: import("@ton/core").Cell | null;
|
|
163
|
+
lzTransferFeeRate?: bigint;
|
|
164
|
+
}> | null;
|
|
165
|
+
strategyConfig: Map<bigint, {
|
|
166
|
+
isExecutable: boolean;
|
|
167
|
+
}> | null;
|
|
168
|
+
afterStrategyConfig: Map<bigint, {
|
|
169
|
+
isExecutable: boolean;
|
|
170
|
+
}> | null;
|
|
171
|
+
lzGasFee: bigint;
|
|
172
|
+
}>;
|
|
173
|
+
xchainUpdateHash: bigint;
|
|
174
|
+
owner: Address;
|
|
175
|
+
manager: Address;
|
|
176
|
+
assets: Record<string, import("../../contracts/vault/strategy-vault").AssetV2>;
|
|
177
|
+
factorialPools: Record<string, import("../../contracts/vault/strategy-vault").FactorialPool>;
|
|
178
|
+
aggregatorIndex: bigint;
|
|
179
|
+
content: import("@ton/core").Cell;
|
|
180
|
+
totalSupply: bigint;
|
|
181
|
+
oracleConfig: import("@ton/core").Cell | import("../../contracts/oracle/redstone-onchain-oracle/type").RedstoneOnchainOracleConfig | import("../../contracts/oracle/redstone-oracle/type").RedstonOracleConfig;
|
|
182
|
+
rfqConfig: {
|
|
183
|
+
priceDeviationTolerance: number;
|
|
184
|
+
rfqEventEmitterAddress: string | null;
|
|
185
|
+
} | null;
|
|
186
|
+
gasConfig: Record<string, bigint> | null;
|
|
187
|
+
isPrivateVault: boolean;
|
|
188
|
+
depositCloseTimestamp: number;
|
|
189
|
+
withdrawOpenTimestamp: number;
|
|
190
|
+
whitelistedMinters: import("@ton/core").Dictionary<Address, Boolean>;
|
|
191
|
+
lastCollectTime: number;
|
|
192
|
+
managementFeeRatePerYear: number;
|
|
193
|
+
protocolFeeRatePerYear: number;
|
|
194
|
+
collectedManagementFee: bigint;
|
|
195
|
+
collectedProtocolFee: bigint;
|
|
196
|
+
rfqCode: import("@ton/core").Cell;
|
|
197
|
+
walletCode: import("@ton/core").Cell;
|
|
198
|
+
dataAggregatorCode: import("@ton/core").Cell;
|
|
199
|
+
protocolFeeManagerAddress: Address;
|
|
200
|
+
rfqIndex: bigint;
|
|
201
|
+
isExecutingStrategy: boolean;
|
|
202
|
+
maxLeverageRatio: number;
|
|
203
|
+
assetWalletDict: Record<string, string>;
|
|
204
|
+
walletAssetDict: Record<string, string>;
|
|
205
|
+
managementFeeRecipientAddress: Address | null;
|
|
206
|
+
guardianAddress: Address | null;
|
|
207
|
+
timelock: bigint;
|
|
208
|
+
pendingOwnerActionIndex: bigint;
|
|
209
|
+
pendingOwnerActionCount: bigint;
|
|
210
|
+
pendingOwnerAction: any;
|
|
211
|
+
getFactorialPoolAsset: (poolAddress: Address, assetAddress: Address) => import("../../contracts/vault/strategy-vault").FactorialPoolShare;
|
|
212
|
+
getAsset: (assetAddress: Address) => import("../../contracts/vault/strategy-vault").AssetV2;
|
|
213
|
+
version: string;
|
|
214
|
+
address: Address;
|
|
215
|
+
balance: bigint;
|
|
216
|
+
code: import("@ton/core").Cell;
|
|
217
|
+
} | {
|
|
218
|
+
globalDepositValueCap: bigint;
|
|
219
|
+
withdrawFeeRate: number;
|
|
220
|
+
queueWithdrawFeeRate: number;
|
|
221
|
+
depositQueueManager: import("../../contracts/vault/strategy-vault").QueueManager;
|
|
222
|
+
withdrawQueueManager: import("../../contracts/vault/strategy-vault").QueueManager;
|
|
223
|
+
interactiveVaultDict: Record<string, import("../../contracts/vault/strategy-vault").InteractiveVaultConfigItem>;
|
|
224
|
+
xchainConnectorAddress: null;
|
|
225
|
+
xchainConfig: null;
|
|
226
|
+
xchainUpdateHash: bigint;
|
|
227
|
+
owner: Address;
|
|
228
|
+
manager: Address;
|
|
229
|
+
assets: Record<string, import("../../contracts/vault/strategy-vault").AssetV2>;
|
|
230
|
+
factorialPools: Record<string, import("../../contracts/vault/strategy-vault").FactorialPool>;
|
|
231
|
+
aggregatorIndex: bigint;
|
|
232
|
+
content: import("@ton/core").Cell;
|
|
233
|
+
totalSupply: bigint;
|
|
234
|
+
oracleConfig: import("@ton/core").Cell | import("../../contracts/oracle/redstone-onchain-oracle/type").RedstoneOnchainOracleConfig | import("../../contracts/oracle/redstone-oracle/type").RedstonOracleConfig;
|
|
235
|
+
rfqConfig: {
|
|
236
|
+
priceDeviationTolerance: number;
|
|
237
|
+
rfqEventEmitterAddress: string | null;
|
|
238
|
+
} | null;
|
|
239
|
+
gasConfig: Record<string, bigint> | null;
|
|
240
|
+
isPrivateVault: boolean;
|
|
241
|
+
depositCloseTimestamp: number;
|
|
242
|
+
withdrawOpenTimestamp: number;
|
|
243
|
+
whitelistedMinters: import("@ton/core").Dictionary<Address, Boolean>;
|
|
244
|
+
lastCollectTime: number;
|
|
245
|
+
managementFeeRatePerYear: number;
|
|
246
|
+
protocolFeeRatePerYear: number;
|
|
247
|
+
collectedManagementFee: bigint;
|
|
248
|
+
collectedProtocolFee: bigint;
|
|
249
|
+
rfqCode: import("@ton/core").Cell;
|
|
250
|
+
walletCode: import("@ton/core").Cell;
|
|
251
|
+
dataAggregatorCode: import("@ton/core").Cell;
|
|
252
|
+
protocolFeeManagerAddress: Address;
|
|
253
|
+
rfqIndex: bigint;
|
|
254
|
+
isExecutingStrategy: boolean;
|
|
255
|
+
maxLeverageRatio: number;
|
|
256
|
+
assetWalletDict: Record<string, string>;
|
|
257
|
+
walletAssetDict: Record<string, string>;
|
|
258
|
+
managementFeeRecipientAddress: Address | null;
|
|
259
|
+
guardianAddress: Address | null;
|
|
260
|
+
timelock: bigint;
|
|
261
|
+
pendingOwnerActionIndex: bigint;
|
|
262
|
+
pendingOwnerActionCount: bigint;
|
|
263
|
+
pendingOwnerAction: any;
|
|
264
|
+
getFactorialPoolAsset: (poolAddress: Address, assetAddress: Address) => import("../../contracts/vault/strategy-vault").FactorialPoolShare;
|
|
265
|
+
getAsset: (assetAddress: Address) => import("../../contracts/vault/strategy-vault").AssetV2;
|
|
266
|
+
version: string;
|
|
267
|
+
address: Address;
|
|
268
|
+
balance: bigint;
|
|
269
|
+
code: import("@ton/core").Cell;
|
|
270
|
+
};
|
|
271
|
+
totalSupply: bigint;
|
|
272
|
+
reserves: {
|
|
273
|
+
[k: string]: bigint;
|
|
274
|
+
};
|
|
275
|
+
poolPositions: Record<string, Record<string, {
|
|
276
|
+
supplyShare: bigint;
|
|
277
|
+
supplyAmount: bigint;
|
|
278
|
+
borrowShare: bigint;
|
|
279
|
+
borrowAmount: bigint;
|
|
280
|
+
}>>;
|
|
281
|
+
price: bigint;
|
|
282
|
+
priceInfo: import("../composite-oracle").Prices;
|
|
283
|
+
}>;
|
|
284
|
+
export declare function getPrice(ctx: AffluentContext, strategyVaultAddress: AddressInput): Promise<bigint>;
|
|
285
|
+
export declare function getUnderlyingPrices(ctx: AffluentContext, strategyVaultAddress: AddressInput): Promise<any>;
|
|
@@ -7,10 +7,18 @@ exports.getRFQAuctionAddress = getRFQAuctionAddress;
|
|
|
7
7
|
exports.getRFQAuction = getRFQAuction;
|
|
8
8
|
exports.isVaultAsset = isVaultAsset;
|
|
9
9
|
exports.splitPureAndVaultAsset = splitPureAndVaultAsset;
|
|
10
|
+
exports.getPoolInfoForStrategyVault = getPoolInfoForStrategyVault;
|
|
11
|
+
exports.getPoolPositionsForStrategyVault = getPoolPositionsForStrategyVault;
|
|
12
|
+
exports.getValuationContext = getValuationContext;
|
|
13
|
+
exports.getPrice = getPrice;
|
|
14
|
+
exports.getUnderlyingPrices = getUnderlyingPrices;
|
|
15
|
+
const core_1 = require("@ton/core");
|
|
10
16
|
const utils_1 = require("../../contracts/common/utils");
|
|
11
17
|
const jetton_wallet_1 = require("../../contracts/jetton/jetton-wallet");
|
|
12
18
|
const rfq_auction_1 = require("../../contracts/rfq/rfq_auction");
|
|
13
19
|
const strategy_vault_1 = require("../../contracts/vault/strategy-vault");
|
|
20
|
+
const composite_oracle_1 = require("../composite-oracle");
|
|
21
|
+
const pool_1 = require("../../contracts/core/pool");
|
|
14
22
|
function getVault(ctx, strategyVaultAddress) {
|
|
15
23
|
return ctx.getByContract(strategy_vault_1.StrategyVault, (0, utils_1.toAddress)(strategyVaultAddress));
|
|
16
24
|
}
|
|
@@ -57,3 +65,62 @@ async function splitPureAndVaultAsset(ctx, addresses) {
|
|
|
57
65
|
pureAssetAddresses,
|
|
58
66
|
};
|
|
59
67
|
}
|
|
68
|
+
async function getPoolInfoForStrategyVault(ctx, strategyVaultAddress) {
|
|
69
|
+
const vaultData = await getVault(ctx, strategyVaultAddress).getVaultData();
|
|
70
|
+
return Object.fromEntries(await Promise.all(Object.keys(vaultData.factorialPools)
|
|
71
|
+
.map(async (poolAddress) => {
|
|
72
|
+
const poolData = await ctx.getByContract(pool_1.Pool, core_1.Address.parse(poolAddress)).getPoolData();
|
|
73
|
+
return [poolAddress, poolData];
|
|
74
|
+
})));
|
|
75
|
+
}
|
|
76
|
+
async function getPoolPositionsForStrategyVault(ctx, strategyVaultAddress) {
|
|
77
|
+
const strategyVault = getVault(ctx, strategyVaultAddress);
|
|
78
|
+
const vaultData = await strategyVault.getVaultData();
|
|
79
|
+
const poolInfo = {};
|
|
80
|
+
const poolDatas = await getPoolInfoForStrategyVault(ctx, strategyVaultAddress);
|
|
81
|
+
for (const [poolAddress, poolPosition] of Object.entries(vaultData.factorialPools)) {
|
|
82
|
+
const poolData = poolDatas[poolAddress];
|
|
83
|
+
const position = {};
|
|
84
|
+
for (const [assetAddress, assetPosition] of Object.entries(poolPosition)) {
|
|
85
|
+
const amountPosition = (0, pool_1.positionShareToAmount)(assetPosition, poolData.assets[assetAddress]);
|
|
86
|
+
position[assetAddress] = {
|
|
87
|
+
supplyShare: assetPosition.supply,
|
|
88
|
+
supplyAmount: amountPosition.supply,
|
|
89
|
+
borrowShare: assetPosition.borrow,
|
|
90
|
+
borrowAmount: amountPosition.borrow,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
poolInfo[poolAddress] = position;
|
|
94
|
+
}
|
|
95
|
+
return poolInfo;
|
|
96
|
+
}
|
|
97
|
+
async function getValuationContext(ctx, strategyVaultAddress) {
|
|
98
|
+
const compositeOracle = new composite_oracle_1.CompositeOracleV1(ctx);
|
|
99
|
+
const vaultData = await getVaultData(ctx, (0, utils_1.toAddress)(strategyVaultAddress));
|
|
100
|
+
const { allPrices: priceInfo } = await compositeOracle.getVaultPriceWithDetails((0, utils_1.toAddress)(strategyVaultAddress));
|
|
101
|
+
const vaultPrice = priceInfo[(0, utils_1.toAddress)(strategyVaultAddress).toString()].price;
|
|
102
|
+
if (!vaultPrice)
|
|
103
|
+
throw new Error("Vault price not found");
|
|
104
|
+
const poolPositions = await getPoolPositionsForStrategyVault(ctx, strategyVaultAddress);
|
|
105
|
+
return {
|
|
106
|
+
storage: vaultData,
|
|
107
|
+
totalSupply: vaultData.totalSupply,
|
|
108
|
+
reserves: Object.fromEntries(Object.entries(vaultData.assets)
|
|
109
|
+
.map(([assetAddress, assetData]) => [assetAddress, assetData.cash])),
|
|
110
|
+
poolPositions,
|
|
111
|
+
price: vaultPrice,
|
|
112
|
+
priceInfo,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
async function getPrice(ctx, strategyVaultAddress) {
|
|
116
|
+
const valuationCtx = await getValuationContext(ctx, strategyVaultAddress);
|
|
117
|
+
return valuationCtx.price;
|
|
118
|
+
}
|
|
119
|
+
async function getUnderlyingPrices(ctx, strategyVaultAddress) {
|
|
120
|
+
const valuationCtx = await getValuationContext(ctx, strategyVaultAddress);
|
|
121
|
+
const priceInfoEntries = Object.entries(valuationCtx.priceInfo);
|
|
122
|
+
const underlyingPriceEntries = priceInfoEntries
|
|
123
|
+
.filter(([assetAddress, _]) => valuationCtx.storage.assets[assetAddress])
|
|
124
|
+
.map(([assetAddress, priceInfo]) => [assetAddress, priceInfo.price]);
|
|
125
|
+
return Object.fromEntries(underlyingPriceEntries);
|
|
126
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Address, Sender } from "@ton/ton";
|
|
2
|
+
import { ShareVaultManagerSetTargetWeightAction, ShareVaultManagerSupplyAction, ShareVaultManagerWithdrawAction, ShareVaultUserActionParams } from "./types/action";
|
|
3
|
+
import { TxStep, TxCallBackFn } from "./utils/tracker/type";
|
|
4
|
+
import { ServiceBaseV1 } from "./common/service";
|
|
5
|
+
import { ShareVaultState, WhitelistedPool } from "./contracts/vault/share-vault/type";
|
|
6
|
+
type PoolInfoForShareVault = {
|
|
7
|
+
cash: bigint;
|
|
8
|
+
totalSupplyAmount: bigint;
|
|
9
|
+
totalSupplyShare: bigint;
|
|
10
|
+
vaultSupplyAmount: bigint;
|
|
11
|
+
};
|
|
12
|
+
export declare class ShareVaultV1 extends ServiceBaseV1 {
|
|
13
|
+
private walletAddresses;
|
|
14
|
+
private getJettonWalletAddress;
|
|
15
|
+
findTx(action: any, callbackFn?: TxCallBackFn): Promise<{
|
|
16
|
+
action: {
|
|
17
|
+
type: string;
|
|
18
|
+
params: ShareVaultUserActionParams;
|
|
19
|
+
queryId: bigint;
|
|
20
|
+
};
|
|
21
|
+
steps: TxStep[];
|
|
22
|
+
} | undefined>;
|
|
23
|
+
supply(sender: Sender, params: ShareVaultUserActionParams): Promise<void>;
|
|
24
|
+
supplyAndWaitTx(sender: Sender, params: ShareVaultUserActionParams, callbackFn?: TxCallBackFn): Promise<{
|
|
25
|
+
action: {
|
|
26
|
+
type: string;
|
|
27
|
+
params: ShareVaultUserActionParams;
|
|
28
|
+
queryId: bigint;
|
|
29
|
+
};
|
|
30
|
+
steps: TxStep[];
|
|
31
|
+
}>;
|
|
32
|
+
findSupplyTx(queryId: bigint, params: ShareVaultUserActionParams, callbackFn?: TxCallBackFn): Promise<{
|
|
33
|
+
action: {
|
|
34
|
+
type: string;
|
|
35
|
+
params: ShareVaultUserActionParams;
|
|
36
|
+
queryId: bigint;
|
|
37
|
+
};
|
|
38
|
+
steps: TxStep[];
|
|
39
|
+
}>;
|
|
40
|
+
withdraw(sender: Sender, params: ShareVaultUserActionParams): Promise<void>;
|
|
41
|
+
withdrawAndWaitTx(sender: Sender, params: ShareVaultUserActionParams, callbackFn?: TxCallBackFn): Promise<{
|
|
42
|
+
action: {
|
|
43
|
+
type: string;
|
|
44
|
+
params: ShareVaultUserActionParams;
|
|
45
|
+
queryId: bigint;
|
|
46
|
+
};
|
|
47
|
+
steps: TxStep[];
|
|
48
|
+
}>;
|
|
49
|
+
findWithdrawTx(queryId: bigint, params: ShareVaultUserActionParams, callbackFn?: TxCallBackFn): Promise<{
|
|
50
|
+
action: {
|
|
51
|
+
type: string;
|
|
52
|
+
params: ShareVaultUserActionParams;
|
|
53
|
+
queryId: bigint;
|
|
54
|
+
};
|
|
55
|
+
steps: TxStep[];
|
|
56
|
+
}>;
|
|
57
|
+
supplyToPool(sender: Sender, params: ShareVaultManagerSupplyAction): Promise<void>;
|
|
58
|
+
withdrawFromPool(sender: Sender, params: ShareVaultManagerWithdrawAction): Promise<void>;
|
|
59
|
+
withdrawFromPoolSimulate(sender: Address, params: ShareVaultManagerWithdrawAction): Promise<void>;
|
|
60
|
+
setTargetWeight(sender: Sender, params: ShareVaultManagerSetTargetWeightAction): Promise<void>;
|
|
61
|
+
getVaultData(vaultAddress: Address | string): Promise<ShareVaultState>;
|
|
62
|
+
getPoolCashAmounts(vaultData: ShareVaultState): Promise<Record<string, bigint>>;
|
|
63
|
+
getPoolInfoForShareVault(vaultData: ShareVaultState): Promise<Record<string, PoolInfoForShareVault>>;
|
|
64
|
+
estimateWithdrawLiquidityFulfillmentPoolCount(vaultData: ShareVaultState, requst_vault_shares: bigint): Promise<{
|
|
65
|
+
count: number;
|
|
66
|
+
sortedPools: {
|
|
67
|
+
targetWeightRatio: number;
|
|
68
|
+
poolAddress: string;
|
|
69
|
+
availableAmount: bigint;
|
|
70
|
+
pool: any;
|
|
71
|
+
}[];
|
|
72
|
+
}>;
|
|
73
|
+
getPoolTupleSortedByTargetWeight(whitelistedPools: Record<string, WhitelistedPool>, totalAssetAmount: bigint, totalTargetWeight: bigint, poolInfoForShareVault: Record<string, PoolInfoForShareVault>): {
|
|
74
|
+
targetWeightRatio: number;
|
|
75
|
+
poolAddress: string;
|
|
76
|
+
availableAmount: bigint;
|
|
77
|
+
pool: any;
|
|
78
|
+
}[];
|
|
79
|
+
WTON: {
|
|
80
|
+
unwrap: (sender: Sender, params: {
|
|
81
|
+
amount: bigint;
|
|
82
|
+
sender: Address | string;
|
|
83
|
+
recipient: Address | string;
|
|
84
|
+
}) => Promise<void>;
|
|
85
|
+
wrap: (sender: Sender, params: {
|
|
86
|
+
amount: bigint;
|
|
87
|
+
recipient: Address | string;
|
|
88
|
+
}) => Promise<void>;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export {};
|