@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.
Files changed (104) hide show
  1. package/dist/build/Account.compiled.json +1 -0
  2. package/dist/build/Receipt.compiled.json +1 -0
  3. package/dist/build/WTONWallet.compiled.json +1 -0
  4. package/dist/common/cache.d.ts +16 -0
  5. package/dist/common/cache.js +96 -0
  6. package/dist/common/service.d.ts +20 -0
  7. package/dist/common/service.js +69 -0
  8. package/dist/common/type.d.ts +14 -0
  9. package/dist/common/type.js +2 -0
  10. package/dist/common/unknown-contract.d.ts +14 -0
  11. package/dist/common/unknown-contract.js +18 -0
  12. package/dist/common/versions.d.ts +14 -0
  13. package/dist/common/versions.js +22 -0
  14. package/dist/constants/pool.d.ts +1 -0
  15. package/dist/constants/pool.js +2 -0
  16. package/dist/contracts/_mock/simple-oracle.d.ts +34 -0
  17. package/dist/contracts/_mock/simple-oracle.js +73 -0
  18. package/dist/contracts/vault/share-vault/type.d.ts +30 -0
  19. package/dist/contracts/vault/share-vault/type.js +2 -0
  20. package/dist/contracts/vault/strategy-vault/utils.d.ts +6 -0
  21. package/dist/contracts/vault/strategy-vault/utils.js +32 -0
  22. package/dist/factorial.d.ts +14 -0
  23. package/dist/factorial.js +20 -0
  24. package/dist/farm.d.ts +92 -0
  25. package/dist/farm.js +209 -0
  26. package/dist/monitor.d.ts +57 -0
  27. package/dist/monitor.js +527 -0
  28. package/dist/monitorCacheV1.d.ts +52 -0
  29. package/dist/monitorCacheV1.js +504 -0
  30. package/dist/oracle/oracle-v2.d.ts +39 -0
  31. package/dist/oracle/oracle-v2.js +151 -0
  32. package/dist/oracle/oracle.d.ts +107 -0
  33. package/dist/oracle/oracle.js +392 -0
  34. package/dist/periphery.d.ts +259 -0
  35. package/dist/periphery.js +1087 -0
  36. package/dist/pool.d.ts +216 -0
  37. package/dist/pool.js +2298 -0
  38. package/dist/poolCacheV1.d.ts +139 -0
  39. package/dist/poolCacheV1.js +1841 -0
  40. package/dist/rfq-auction.d.ts +75 -0
  41. package/dist/rfq-auction.js +220 -0
  42. package/dist/rfq-batch.d.ts +112 -0
  43. package/dist/rfq-batch.js +284 -0
  44. package/dist/services/share-vault/computation.d.ts +14 -17
  45. package/dist/services/share-vault/computation.js +39 -0
  46. package/dist/services/share-vault/index.js +6 -3
  47. package/dist/services/share-vault/query.d.ts +38 -8
  48. package/dist/services/share-vault/query.js +20 -27
  49. package/dist/services/share-vault/type.d.ts +19 -0
  50. package/dist/services/share-vault/type.js +2 -0
  51. package/dist/services/share-vault/user/index.js +3 -1
  52. package/dist/services/strategy-vault/computation.d.ts +1 -0
  53. package/dist/services/strategy-vault/computation.js +15 -0
  54. package/dist/services/strategy-vault/query.d.ts +147 -0
  55. package/dist/services/strategy-vault/query.js +67 -0
  56. package/dist/services/strategy-vault/type.d.ts +2 -0
  57. package/dist/services/strategy-vault/type.js +2 -0
  58. package/dist/share-vault.d.ts +91 -0
  59. package/dist/share-vault.js +747 -0
  60. package/dist/stonfi.d.ts +18 -0
  61. package/dist/stonfi.js +76 -0
  62. package/dist/strategy_vault/base.d.ts +399 -0
  63. package/dist/strategy_vault/base.js +1199 -0
  64. package/dist/strategy_vault/index.d.ts +3 -0
  65. package/dist/strategy_vault/index.js +7 -0
  66. package/dist/strategy_vault/steps.d.ts +49 -0
  67. package/dist/strategy_vault/steps.js +170 -0
  68. package/dist/types/action.d.ts +55 -0
  69. package/dist/types/action.js +2 -0
  70. package/dist/types/messages.d.ts +7 -0
  71. package/dist/types/messages.js +2 -0
  72. package/dist/types/params.d.ts +19 -0
  73. package/dist/types/params.js +2 -0
  74. package/dist/types/pool.d.ts +83 -0
  75. package/dist/types/pool.js +2 -0
  76. package/dist/types/transaction.d.ts +40 -0
  77. package/dist/types/transaction.js +2 -0
  78. package/dist/utils/_parse_temp/JumpIRM.d.ts +37 -0
  79. package/dist/utils/_parse_temp/JumpIRM.js +71 -0
  80. package/dist/utils/_parse_temp/Pool.d.ts +559 -0
  81. package/dist/utils/_parse_temp/Pool.js +1023 -0
  82. package/dist/utils/_parse_temp/ShareVault.d.ts +264 -0
  83. package/dist/utils/_parse_temp/ShareVault.js +479 -0
  84. package/dist/utils/_parse_temp/StrategyVault.d.ts +729 -0
  85. package/dist/utils/_parse_temp/StrategyVault.js +1865 -0
  86. package/dist/utils/_parse_temp/parseMsgBody.d.ts +13 -0
  87. package/dist/utils/_parse_temp/parseMsgBody.js +313 -0
  88. package/dist/utils/assert.d.ts +1 -0
  89. package/dist/utils/assert.js +9 -0
  90. package/dist/utils/client-for-parameter.d.ts +12 -0
  91. package/dist/utils/client-for-parameter.js +97 -0
  92. package/dist/utils/oracle/index.d.ts +4 -0
  93. package/dist/utils/oracle/index.js +19 -0
  94. package/dist/utils/oracle/redstone/helper.d.ts +22 -0
  95. package/dist/utils/oracle/redstone/helper.js +186 -0
  96. package/dist/utils/tracer.d.ts +13 -0
  97. package/dist/utils/tracer.js +137 -0
  98. package/dist/utils/tracker/index.d.ts +5 -0
  99. package/dist/utils/tracker/index.js +118 -0
  100. package/dist/utils/tracker/query-id-generactor.d.ts +2 -0
  101. package/dist/utils/tracker/query-id-generactor.js +12 -0
  102. package/dist/utils/tracker/type.d.ts +34 -0
  103. package/dist/utils/tracker/type.js +2 -0
  104. package/package.json +1 -1
package/dist/pool.d.ts ADDED
@@ -0,0 +1,216 @@
1
+ import { Address, Cell, Sender } from "@ton/ton";
2
+ import { PoolState } from "./contracts/core/pool/type";
3
+ import { OnchainDataInfo } from "./contracts/oracle/redstone-onchain-oracle/type";
4
+ import { LiquidateActionParams, TransferInActionParams, TansferOutActionParams } from "./types/action";
5
+ import { TxCallBackFn, TxStep } from "./utils/tracker/type";
6
+ import { AssetPriceInfo } from "./contracts/oracle/redstone-onchain-oracle/type";
7
+ import { AccountAssetState, AccountState } from "./contracts/core/account/type";
8
+ import { ServiceBaseV1 } from "./common/service";
9
+ import { MaxBorrowableResult, MaxWithdrawableResult } from "./types/pool";
10
+ export declare class PoolV1 extends ServiceBaseV1 {
11
+ private walletAddresses;
12
+ private accountAddresses;
13
+ private getJettonWalletAddress;
14
+ getAccountAddress(owner: string, pool: string): Promise<Address>;
15
+ findAndCallback(target: Address, step: TxStep, createdLt: string | bigint, callbackFn?: TxCallBackFn): Promise<import("./utils/tracker/type").MatchedTxResult>;
16
+ supply(sender: Sender, params: TransferInActionParams): Promise<void>;
17
+ supplyAndWaitTx(sender: Sender, params: TransferInActionParams, callbackFn?: TxCallBackFn): Promise<{
18
+ action: {
19
+ type: string;
20
+ params: TransferInActionParams;
21
+ queryId: bigint;
22
+ };
23
+ steps: TxStep[];
24
+ }>;
25
+ findTx(action: any, callbackFn?: TxCallBackFn): Promise<{
26
+ action: {
27
+ type: string;
28
+ params: TransferInActionParams;
29
+ queryId: bigint;
30
+ };
31
+ steps: TxStep[];
32
+ } | undefined>;
33
+ findSupplyTx(queryId: bigint, params: TransferInActionParams, callbackFn?: TxCallBackFn): Promise<{
34
+ action: {
35
+ type: string;
36
+ params: TransferInActionParams;
37
+ queryId: bigint;
38
+ };
39
+ steps: TxStep[];
40
+ }>;
41
+ withdraw(sender: Sender, params: TansferOutActionParams): Promise<void>;
42
+ withdrawAndWaitTx(sender: Sender, params: TansferOutActionParams, callbackFn?: TxCallBackFn): Promise<{
43
+ action: {
44
+ type: string;
45
+ params: TansferOutActionParams;
46
+ queryId: bigint;
47
+ };
48
+ steps: TxStep[];
49
+ }>;
50
+ findWithdrawTx(queryId: bigint, params: TansferOutActionParams, callbackFn?: TxCallBackFn): Promise<{
51
+ action: {
52
+ type: string;
53
+ params: TansferOutActionParams;
54
+ queryId: bigint;
55
+ };
56
+ steps: TxStep[];
57
+ }>;
58
+ borrow(sender: Sender, params: TansferOutActionParams): Promise<void>;
59
+ borrowAndWaitTx(sender: Sender, params: TansferOutActionParams, callbackFn?: TxCallBackFn): Promise<{
60
+ action: {
61
+ type: string;
62
+ params: TansferOutActionParams;
63
+ queryId: bigint;
64
+ };
65
+ steps: TxStep[];
66
+ }>;
67
+ findBorrowTx(queryId: bigint, params: TansferOutActionParams, callbackFn?: TxCallBackFn): Promise<{
68
+ action: {
69
+ type: string;
70
+ params: TansferOutActionParams;
71
+ queryId: bigint;
72
+ };
73
+ steps: TxStep[];
74
+ }>;
75
+ repay(sender: Sender, params: TransferInActionParams): Promise<void>;
76
+ repayAndWaitTx(sender: Sender, params: TransferInActionParams, callbackFn?: TxCallBackFn): Promise<{
77
+ action: {
78
+ type: string;
79
+ params: TransferInActionParams;
80
+ queryId: bigint;
81
+ };
82
+ steps: TxStep[];
83
+ }>;
84
+ findRepayTx(queryId: bigint, params: TransferInActionParams, callbackFn?: TxCallBackFn): Promise<{
85
+ action: {
86
+ type: string;
87
+ params: TransferInActionParams;
88
+ queryId: bigint;
89
+ };
90
+ steps: TxStep[];
91
+ }>;
92
+ liquidateSimulate(params: LiquidateActionParams): Promise<void>;
93
+ liquidateAndWaitTxSimulate(queryId: bigint, params: LiquidateActionParams, callbackFn?: TxCallBackFn): Promise<TxStep[]>;
94
+ liquidate(sender: Sender, params: LiquidateActionParams): Promise<void>;
95
+ liquidateAndWaitTx(sender: Sender, params: LiquidateActionParams, callbackFn?: TxCallBackFn): Promise<{
96
+ action: {
97
+ type: string;
98
+ params: LiquidateActionParams;
99
+ queryId: bigint;
100
+ };
101
+ steps: TxStep[];
102
+ }>;
103
+ updateOnchainData(onchainDataInfo: OnchainDataInfo): Promise<OnchainDataInfo>;
104
+ getRedstonePrices(assets: string[], poolData: any): Promise<{
105
+ redstonePrices: AssetPriceInfo;
106
+ onchainData: any;
107
+ }>;
108
+ calculatePrices(_prices: AssetPriceInfo, oracleData: any): AssetPriceInfo;
109
+ decomposeAccountStatus(accountStatus: Record<string, AccountAssetState>, prices: AssetPriceInfo, onchainData: OnchainDataInfo): Record<string, Omit<AccountAssetState, "address">>;
110
+ calculateRisk(decomposedAccountStatus: Record<string, Omit<AccountAssetState, "address">>, prices: AssetPriceInfo, poolData: PoolState): {
111
+ result: boolean;
112
+ healthy: boolean;
113
+ unhealthy: boolean;
114
+ collateral: bigint;
115
+ debt: bigint;
116
+ risk: bigint;
117
+ riskRatio: bigint;
118
+ leverageRatio: bigint;
119
+ };
120
+ getOracleRequestParams(assets: string[], oracleConfig: any): Promise<{
121
+ feedIds: bigint[];
122
+ redstoneAssetNames: any[];
123
+ requestAssets: Address[];
124
+ redstoneAssets: Address[];
125
+ }>;
126
+ isHealthy(poolAddress: Address | string, ownerAddress: Address | string, delta?: Record<string, AccountAssetState>): Promise<{
127
+ result: boolean;
128
+ healthy: boolean;
129
+ unhealthy: boolean;
130
+ collateral: bigint;
131
+ debt: bigint;
132
+ risk: bigint;
133
+ riskRatio: bigint;
134
+ leverageRatio: bigint;
135
+ }>;
136
+ isHealthyV2(_poolData: PoolState, _accountData: Record<string, AccountAssetState>, prices: any): {
137
+ result: boolean;
138
+ healthy: boolean;
139
+ unhealthy: boolean;
140
+ collateral: bigint;
141
+ debt: bigint;
142
+ risk: bigint;
143
+ riskRatio: bigint;
144
+ leverageRatio: bigint;
145
+ };
146
+ getPrices(poolAddress: Address | string): Promise<{
147
+ [x: string]: import("./contracts/oracle/redstone-onchain-oracle/type").AssetPrice | {
148
+ price: bigint;
149
+ type: number;
150
+ additionalData: {
151
+ decomposed: Record<string, {
152
+ supply: bigint;
153
+ borrow: bigint;
154
+ }>;
155
+ totalSupply: bigint;
156
+ };
157
+ };
158
+ }>;
159
+ getPricesV2(poolAddress: Address | string): Promise<{
160
+ [x: string]: import("./contracts/oracle/redstone-onchain-oracle/type").AssetPrice | {
161
+ price: bigint;
162
+ type: number;
163
+ additionalData: {
164
+ decomposed: Record<string, {
165
+ supply: bigint;
166
+ borrow: bigint;
167
+ }>;
168
+ totalSupply: bigint;
169
+ };
170
+ };
171
+ }>;
172
+ calculateVaultPrices(price: AssetPriceInfo, poolInfos: Record<string, PoolState>, vaults: Record<string, VaultPosition>): Promise<Record<string, {
173
+ price: bigint;
174
+ type: number;
175
+ additionalData: {
176
+ decomposed: Record<string, {
177
+ supply: bigint;
178
+ borrow: bigint;
179
+ }>;
180
+ totalSupply: bigint;
181
+ };
182
+ }>>;
183
+ getParsedVaults(vaultAddresses: (Address | string)[]): Promise<Record<string, VaultPosition>>;
184
+ getExposures(vaults: Record<string, VaultPosition>): Promise<{
185
+ pools: string[];
186
+ assets: string[];
187
+ }>;
188
+ calculateMaxBorrowableAmount({ borrowerAddress, poolAddress, tokenAddress, BUFFER, }: {
189
+ borrowerAddress: Address;
190
+ poolAddress: Address;
191
+ tokenAddress: string;
192
+ BUFFER?: bigint;
193
+ }): Promise<MaxBorrowableResult>;
194
+ calculateMaxWithdrawableAmount({ withdrawerAddress, poolAddress, tokenAddress, BUFFER, }: {
195
+ withdrawerAddress: Address;
196
+ poolAddress: Address;
197
+ tokenAddress: string;
198
+ BUFFER?: bigint;
199
+ }): Promise<MaxWithdrawableResult>;
200
+ getPoolData(poolAddress: Address | string): Promise<PoolState>;
201
+ getAccountData(poolAddress: Address | string, userAddress: Address | string): Promise<AccountState>;
202
+ separateAssets(_assets: string[], oracleConfig: any): Promise<{
203
+ assets: string[];
204
+ vaultAssets: string[];
205
+ }>;
206
+ getPoolOracleParams(poolAddress: Address | string, actor: Address | string, executeAsset: Address | string): Promise<Cell>;
207
+ }
208
+ type VaultPosition = {
209
+ assets: Record<string, bigint>;
210
+ poolPositions: Record<string, Record<string, {
211
+ supply: bigint;
212
+ borrow: bigint;
213
+ }>>;
214
+ totalSupply: bigint;
215
+ };
216
+ export {};