@magmaprotocol/magma-clmm-sdk 0.5.75 → 0.5.77
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/README.md +6 -10
- package/dist/index.d.ts +2 -424
- package/dist/index.js +145 -1594
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +144 -1583
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<br />
|
|
8
8
|
<div align="center">
|
|
9
9
|
<a >
|
|
10
|
-
<img src="
|
|
10
|
+
<img src="./icon_color.svg" alt="Logo" width="100" height="100">
|
|
11
11
|
</a>
|
|
12
12
|
|
|
13
13
|
<h3 align="center">Magma-CLMM-SDK</h3>
|
|
@@ -43,7 +43,7 @@ Our SDK now includes a default initialization method that allows for quick gener
|
|
|
43
43
|
```typescript
|
|
44
44
|
import { initMagmaSDK } from '@magmaprotocol/magma-clmm-sdk'
|
|
45
45
|
|
|
46
|
-
const magmaClmmSDK = initMagmaSDK({
|
|
46
|
+
const magmaClmmSDK = initMagmaSDK({network: 'mainnet'})
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
If you wish to set your own full node URL and simulate address, you can do so as follows:
|
|
@@ -51,28 +51,24 @@ If you wish to set your own full node URL and simulate address, you can do so as
|
|
|
51
51
|
```typescript
|
|
52
52
|
import { initMagmaSDK } from '@magmaprotocol/magma-clmm-sdk'
|
|
53
53
|
|
|
54
|
-
const network = 'mainnnet'
|
|
55
|
-
const fullNodeUrl =
|
|
56
|
-
const simulationAccount =
|
|
57
|
-
const magmaClmmSDK = initMagmaSDK({
|
|
54
|
+
const network = 'mainnnet';
|
|
55
|
+
const fullNodeUrl = "https://..."
|
|
56
|
+
const simulationAccount = "0x..."
|
|
57
|
+
const magmaClmmSDK = initMagmaSDK({network, fullNodeUrl, simulationAccount})
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
Now, you can start using Magma SDK.
|
|
61
61
|
|
|
62
62
|
### Typrscript Doc
|
|
63
|
-
|
|
64
63
|
You can view this typescript sdk in
|
|
65
64
|
<a href="https://github.com/MagmaFinanceIO/magma_sdk_doc"><strong> Magma Development Documents. </strong></a>
|
|
66
65
|
<br />
|
|
67
66
|
|
|
68
67
|
## LICENSE
|
|
69
|
-
|
|
70
68
|
MAGMA-CLMM-SDK released under the Apache license. See the [LICENSE](./LICENSE) file for details.
|
|
71
69
|
|
|
72
70
|
## More About Magma
|
|
73
|
-
|
|
74
71
|
Use the following links to learn more about Magma:
|
|
75
|
-
|
|
76
72
|
- [ ] Learn more about working with Magma in the [Magma Documentation]().
|
|
77
73
|
|
|
78
74
|
- [ ] Join the Magma community on [Magma Discord]().
|
package/dist/index.d.ts
CHANGED
|
@@ -37,7 +37,6 @@ declare const Voter = "voter";
|
|
|
37
37
|
declare const RewardDistributor = "reward_distributor";
|
|
38
38
|
declare const Gauge = "gauge";
|
|
39
39
|
declare const Minter = "minter";
|
|
40
|
-
declare const DlmmScript = "dlmm_script";
|
|
41
40
|
/**
|
|
42
41
|
* The address for CoinInfo module.
|
|
43
42
|
*/
|
|
@@ -452,9 +451,6 @@ type ClmmConfig = {
|
|
|
452
451
|
*/
|
|
453
452
|
partners_id?: SuiObjectIdType;
|
|
454
453
|
};
|
|
455
|
-
type DlmmConfig = {
|
|
456
|
-
factory: SuiObjectIdType;
|
|
457
|
-
};
|
|
458
454
|
/**
|
|
459
455
|
* Represents an event to create a liquidity mining partner.
|
|
460
456
|
*/
|
|
@@ -1632,239 +1628,6 @@ type GetRewardByPosition = {
|
|
|
1632
1628
|
coinTypeB: string;
|
|
1633
1629
|
};
|
|
1634
1630
|
|
|
1635
|
-
type FetchPairParams = {
|
|
1636
|
-
pair: string;
|
|
1637
|
-
coinTypeA: string;
|
|
1638
|
-
coinTypeB: string;
|
|
1639
|
-
};
|
|
1640
|
-
type CreatePairParams = {
|
|
1641
|
-
bin_step: number;
|
|
1642
|
-
base_fee: number;
|
|
1643
|
-
coinTypeA: string;
|
|
1644
|
-
coinTypeB: string;
|
|
1645
|
-
coinADecimal: number;
|
|
1646
|
-
coinBDecimal: number;
|
|
1647
|
-
priceTokenBPerTokenA: string;
|
|
1648
|
-
};
|
|
1649
|
-
type MintPercentParams = {
|
|
1650
|
-
pair: string;
|
|
1651
|
-
coinTypeA: string;
|
|
1652
|
-
coinTypeB: string;
|
|
1653
|
-
amountATotal: number;
|
|
1654
|
-
amountBTotal: number;
|
|
1655
|
-
storageIds: number[];
|
|
1656
|
-
binsAPercent: number[];
|
|
1657
|
-
binsBPercent: number[];
|
|
1658
|
-
to: string;
|
|
1659
|
-
};
|
|
1660
|
-
type MintAmountParams = {
|
|
1661
|
-
pair: string;
|
|
1662
|
-
coinTypeA: string;
|
|
1663
|
-
coinTypeB: string;
|
|
1664
|
-
amountATotal: number;
|
|
1665
|
-
amountBTotal: number;
|
|
1666
|
-
storageIds: number[];
|
|
1667
|
-
amountsA: number[];
|
|
1668
|
-
amountsB: number[];
|
|
1669
|
-
to: string;
|
|
1670
|
-
};
|
|
1671
|
-
type DLMMSwapParams = {
|
|
1672
|
-
pair: string;
|
|
1673
|
-
coinTypeA: string;
|
|
1674
|
-
coinTypeB: string;
|
|
1675
|
-
amountIn: number;
|
|
1676
|
-
minAmountOut: number;
|
|
1677
|
-
swapForY: boolean;
|
|
1678
|
-
to: string;
|
|
1679
|
-
};
|
|
1680
|
-
type FetchBinsParams = {
|
|
1681
|
-
pair: string;
|
|
1682
|
-
coinTypeA: string;
|
|
1683
|
-
coinTypeB: string;
|
|
1684
|
-
offset: number;
|
|
1685
|
-
limit: number;
|
|
1686
|
-
};
|
|
1687
|
-
type GetPositionLiquidityParams = {
|
|
1688
|
-
pair: string;
|
|
1689
|
-
positionId: string;
|
|
1690
|
-
coinTypeA: string;
|
|
1691
|
-
coinTypeB: string;
|
|
1692
|
-
};
|
|
1693
|
-
type GetPairLiquidityParams = {
|
|
1694
|
-
pair: string;
|
|
1695
|
-
coinTypeA: string;
|
|
1696
|
-
coinTypeB: string;
|
|
1697
|
-
};
|
|
1698
|
-
type EventPairParams = {
|
|
1699
|
-
base_factor: number;
|
|
1700
|
-
filter_period: number;
|
|
1701
|
-
decay_period: number;
|
|
1702
|
-
reduction_factor: number;
|
|
1703
|
-
variable_fee_control: number;
|
|
1704
|
-
protocol_share: number;
|
|
1705
|
-
max_volatility_accumulator: number;
|
|
1706
|
-
volatility_accumulator: number;
|
|
1707
|
-
volatility_reference: number;
|
|
1708
|
-
index_reference: number;
|
|
1709
|
-
time_of_last_update: number | string;
|
|
1710
|
-
oracle_index: number;
|
|
1711
|
-
active_index: number;
|
|
1712
|
-
};
|
|
1713
|
-
type EventBin = {
|
|
1714
|
-
storage_id: number | string;
|
|
1715
|
-
price_q128: number | string;
|
|
1716
|
-
reserve_x: number | string;
|
|
1717
|
-
reserve_y: number | string;
|
|
1718
|
-
staked_liquidity: number | string;
|
|
1719
|
-
staked_lp_amount: number | string;
|
|
1720
|
-
fee_x: number | string;
|
|
1721
|
-
fee_y: number | string;
|
|
1722
|
-
fee_growth_x: number | string;
|
|
1723
|
-
fee_growth_y: number | string;
|
|
1724
|
-
rewarder_growth: number[] | string[];
|
|
1725
|
-
distribution_growth: number | string;
|
|
1726
|
-
distribution_last_updated: number | string;
|
|
1727
|
-
};
|
|
1728
|
-
type EventPositionLiquidity = {
|
|
1729
|
-
shares: number | string;
|
|
1730
|
-
liquidity: number | string;
|
|
1731
|
-
x_equivalent: number | string;
|
|
1732
|
-
y_equivalent: number | string;
|
|
1733
|
-
bin_real_ids: number[];
|
|
1734
|
-
bin_x_eq: number[] | string[];
|
|
1735
|
-
bin_y_eq: number[] | string[];
|
|
1736
|
-
bin_liquidity: number[] | string[];
|
|
1737
|
-
};
|
|
1738
|
-
type EventPairLiquidity = {
|
|
1739
|
-
shares: number | string;
|
|
1740
|
-
liquidity: number | string;
|
|
1741
|
-
x: number | string;
|
|
1742
|
-
y: number | string;
|
|
1743
|
-
bin_ids: number[] | string[];
|
|
1744
|
-
bin_x: number[] | string[];
|
|
1745
|
-
bin_y: number[] | string[];
|
|
1746
|
-
};
|
|
1747
|
-
type DlmmPoolInfo = {
|
|
1748
|
-
pool_id: string;
|
|
1749
|
-
bin_step: number;
|
|
1750
|
-
coin_a: string;
|
|
1751
|
-
coin_b: string;
|
|
1752
|
-
base_factor: number;
|
|
1753
|
-
base_fee: number;
|
|
1754
|
-
active_index: number;
|
|
1755
|
-
};
|
|
1756
|
-
type DlmmAddLiquidityParams = {
|
|
1757
|
-
pool_id: string;
|
|
1758
|
-
coin_a: string;
|
|
1759
|
-
coin_b: string;
|
|
1760
|
-
position_id: string;
|
|
1761
|
-
amounts_a: number[];
|
|
1762
|
-
amounts_b: number[];
|
|
1763
|
-
receiver: string;
|
|
1764
|
-
rewards_token: string[];
|
|
1765
|
-
};
|
|
1766
|
-
type DlmmBurnPositionParams = {
|
|
1767
|
-
pool_id: string;
|
|
1768
|
-
position_id: string;
|
|
1769
|
-
coin_a: string;
|
|
1770
|
-
coin_b: string;
|
|
1771
|
-
rewards_token: string[];
|
|
1772
|
-
};
|
|
1773
|
-
type DlmmShrinkPosition = {
|
|
1774
|
-
pool_id: string;
|
|
1775
|
-
position_id: string;
|
|
1776
|
-
coin_a: string;
|
|
1777
|
-
coin_b: string;
|
|
1778
|
-
delta_percentage: number;
|
|
1779
|
-
rewards_token: string[];
|
|
1780
|
-
};
|
|
1781
|
-
type DlmmCollectRewardParams = {
|
|
1782
|
-
pool_id: string;
|
|
1783
|
-
coin_a: string;
|
|
1784
|
-
coin_b: string;
|
|
1785
|
-
position_id: string;
|
|
1786
|
-
rewards_token: string[];
|
|
1787
|
-
};
|
|
1788
|
-
type DlmmCollectFeeParams = {
|
|
1789
|
-
pool_id: string;
|
|
1790
|
-
coin_a: string;
|
|
1791
|
-
coin_b: string;
|
|
1792
|
-
position_id: string;
|
|
1793
|
-
};
|
|
1794
|
-
type DlmmRewardsParams = {
|
|
1795
|
-
pool_id: string;
|
|
1796
|
-
position_id: string;
|
|
1797
|
-
coin_a: string;
|
|
1798
|
-
coin_b: string;
|
|
1799
|
-
rewards_token: string[];
|
|
1800
|
-
};
|
|
1801
|
-
type DlmmEventEarnedFees = {
|
|
1802
|
-
position_id: string;
|
|
1803
|
-
x: string;
|
|
1804
|
-
y: string;
|
|
1805
|
-
fee_x: number;
|
|
1806
|
-
fee_y: number;
|
|
1807
|
-
};
|
|
1808
|
-
type DlmmEventEarnedRewards = {
|
|
1809
|
-
position_id: string;
|
|
1810
|
-
reward: string[];
|
|
1811
|
-
amount: number[];
|
|
1812
|
-
};
|
|
1813
|
-
type GetPairRewarderParams = {
|
|
1814
|
-
pool_id: string;
|
|
1815
|
-
coin_a: string;
|
|
1816
|
-
coin_b: string;
|
|
1817
|
-
};
|
|
1818
|
-
type DlmmEventPairRewardTypes = {
|
|
1819
|
-
pair_id: string;
|
|
1820
|
-
tokens: string[];
|
|
1821
|
-
};
|
|
1822
|
-
type BinDisplay = {
|
|
1823
|
-
binId: number;
|
|
1824
|
-
amountX: BN;
|
|
1825
|
-
amountY: BN;
|
|
1826
|
-
};
|
|
1827
|
-
type DlmmCreatePairAddLiquidityParams = {
|
|
1828
|
-
baseFee: number;
|
|
1829
|
-
binStep: number;
|
|
1830
|
-
coinTypeA: string;
|
|
1831
|
-
coinTypeB: string;
|
|
1832
|
-
activeId: number;
|
|
1833
|
-
realIds: number[];
|
|
1834
|
-
amountsX: number[];
|
|
1835
|
-
amountsY: number[];
|
|
1836
|
-
to: string;
|
|
1837
|
-
};
|
|
1838
|
-
type DlmmPosition = {
|
|
1839
|
-
pos_object_id: SuiObjectIdType;
|
|
1840
|
-
owner: SuiObjectIdType;
|
|
1841
|
-
pool: SuiObjectIdType;
|
|
1842
|
-
type: SuiAddressType;
|
|
1843
|
-
bin_real_ids: number[];
|
|
1844
|
-
};
|
|
1845
|
-
type DlmmPositionInfo = {
|
|
1846
|
-
position: DlmmPosition;
|
|
1847
|
-
liquidity: EventPositionLiquidity;
|
|
1848
|
-
rewards: DlmmEventEarnedRewards;
|
|
1849
|
-
fees: DlmmEventEarnedFees;
|
|
1850
|
-
contractPool: DlmmPoolInfo | undefined;
|
|
1851
|
-
};
|
|
1852
|
-
type MintByStrategyParams = {
|
|
1853
|
-
pair: string;
|
|
1854
|
-
bin_step: number;
|
|
1855
|
-
coinTypeA: string;
|
|
1856
|
-
coinTypeB: string;
|
|
1857
|
-
amountATotal: number;
|
|
1858
|
-
amountBTotal: number;
|
|
1859
|
-
fixCoinA: boolean;
|
|
1860
|
-
fixCoinB: boolean;
|
|
1861
|
-
strategy: number;
|
|
1862
|
-
min_bin: number;
|
|
1863
|
-
max_bin: number;
|
|
1864
|
-
active_bin: number;
|
|
1865
|
-
slippage: number;
|
|
1866
|
-
};
|
|
1867
|
-
|
|
1868
1631
|
type BigNumber = Decimal.Value | number | string;
|
|
1869
1632
|
|
|
1870
1633
|
interface IModule {
|
|
@@ -2413,118 +2176,6 @@ type CollectFeesQuote = {
|
|
|
2413
2176
|
*/
|
|
2414
2177
|
declare function collectFeesQuote(param: CollectFeesQuoteParam): CollectFeesQuote;
|
|
2415
2178
|
|
|
2416
|
-
declare enum StrategyType {
|
|
2417
|
-
Spot = 1,
|
|
2418
|
-
Curve = 2,
|
|
2419
|
-
BidAsk = 3
|
|
2420
|
-
}
|
|
2421
|
-
type BinLiquidity = {
|
|
2422
|
-
ActiveId: number;
|
|
2423
|
-
StorageId: number;
|
|
2424
|
-
Price: number;
|
|
2425
|
-
CoinAType: number;
|
|
2426
|
-
CoinBType: number;
|
|
2427
|
-
CoinAAmount: number;
|
|
2428
|
-
CoinBAmount: number;
|
|
2429
|
-
};
|
|
2430
|
-
declare function autoFillYByStrategy(activeId: number, binStep: number, amountX: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, minBinId: number, maxBinId: number, strategyType: StrategyType): BN;
|
|
2431
|
-
declare function autoFillXByStrategy(activeId: number, binStep: number, amountY: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, minBinId: number, maxBinId: number, strategyType: StrategyType): BN;
|
|
2432
|
-
/**
|
|
2433
|
-
* Given a strategy type and amounts of X and Y, returns the distribution of liquidity.
|
|
2434
|
-
* @param activeId The bin id of the active bin.
|
|
2435
|
-
* @param binStep The step size of each bin.
|
|
2436
|
-
* @param minBinId The min bin id.
|
|
2437
|
-
* @param maxBinId The max bin id.
|
|
2438
|
-
* @param amountX The amount of X token to deposit.
|
|
2439
|
-
* @param amountY The amount of Y token to deposit.
|
|
2440
|
-
* @param amountXInActiveBin The amount of X token in the active bin.
|
|
2441
|
-
* @param amountYInActiveBin The amount of Y token in the active bin.
|
|
2442
|
-
* @param strategyType The strategy type.
|
|
2443
|
-
* @param mintX The mint info of X token. Get from DLMM instance.
|
|
2444
|
-
* @param mintY The mint info of Y token. Get from DLMM instance.
|
|
2445
|
-
* @param clock The clock info. Get from DLMM instance.
|
|
2446
|
-
* @returns The distribution of liquidity.
|
|
2447
|
-
*/
|
|
2448
|
-
declare function toAmountsBothSideByStrategy(activeId: number, binStep: number, minBinId: number, maxBinId: number, amountX: BN, amountY: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, strategyType: StrategyType): BinDisplay[];
|
|
2449
|
-
|
|
2450
|
-
declare function getPriceOfBinByBinId(binId: number, binStep: number): Decimal;
|
|
2451
|
-
declare function autoFillYByWeight(activeId: number, binStep: number, amountX: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, distributions: {
|
|
2452
|
-
binId: number;
|
|
2453
|
-
weight: number;
|
|
2454
|
-
}[]): BN;
|
|
2455
|
-
declare function autoFillXByWeight(activeId: number, binStep: number, amountY: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, distributions: {
|
|
2456
|
-
binId: number;
|
|
2457
|
-
weight: number;
|
|
2458
|
-
}[]): BN;
|
|
2459
|
-
/**
|
|
2460
|
-
* Distribute totalAmount to all bid side bins according to given distributions.
|
|
2461
|
-
* @param activeId active bin id
|
|
2462
|
-
* @param totalAmount total amount of token Y to be distributed
|
|
2463
|
-
* @param distributions weight distribution of each bin
|
|
2464
|
-
* @param mintY mint of token Y, get from DLMM instance
|
|
2465
|
-
* @param clock clock of the program, for calculating transfer fee, get from DLMM instance
|
|
2466
|
-
* @returns array of {binId, amount} where amount is the amount of token Y in each bin
|
|
2467
|
-
*/
|
|
2468
|
-
declare function toAmountBidSide(activeId: number, totalAmount: BN, distributions: {
|
|
2469
|
-
binId: number;
|
|
2470
|
-
weight: number;
|
|
2471
|
-
}[]): {
|
|
2472
|
-
binId: number;
|
|
2473
|
-
amount: BN;
|
|
2474
|
-
}[];
|
|
2475
|
-
/**
|
|
2476
|
-
* Distribute totalAmount to all ask side bins according to given distributions.
|
|
2477
|
-
* @param activeId active bin id
|
|
2478
|
-
* @param totalAmount total amount of token Y to be distributed
|
|
2479
|
-
* @param distributions weight distribution of each bin
|
|
2480
|
-
* @param mintX mint of token X, get from DLMM instance
|
|
2481
|
-
* @param clock clock of the program, for calculating transfer fee, get from DLMM instance
|
|
2482
|
-
* @returns array of {binId, amount} where amount is the amount of token X in each bin
|
|
2483
|
-
*/
|
|
2484
|
-
declare function toAmountAskSide(activeId: number, binStep: number, totalAmount: BN, distributions: {
|
|
2485
|
-
binId: number;
|
|
2486
|
-
weight: number;
|
|
2487
|
-
}[]): {
|
|
2488
|
-
binId: number;
|
|
2489
|
-
amount: BN;
|
|
2490
|
-
}[];
|
|
2491
|
-
/**
|
|
2492
|
-
* Distributes the given amounts of tokens X and Y to both bid and ask side bins
|
|
2493
|
-
* based on the provided weight distributions.
|
|
2494
|
-
*
|
|
2495
|
-
* @param activeId - The id of the active bin.
|
|
2496
|
-
* @param binStep - The step interval between bin ids.
|
|
2497
|
-
* @param amountX - Total amount of token X to distribute.
|
|
2498
|
-
* @param amountY - Total amount of token Y to distribute.
|
|
2499
|
-
* @param amountXInActiveBin - Amount of token X already in the active bin.
|
|
2500
|
-
* @param amountYInActiveBin - Amount of token Y already in the active bin.
|
|
2501
|
-
* @param distributions - Array of bins with their respective weight distributions.
|
|
2502
|
-
* @param mintX - Mint information for token X. Get from DLMM instance.
|
|
2503
|
-
* @param mintY - Mint information for token Y. Get from DLMM instance.
|
|
2504
|
-
* @param clock - Clock instance. Get from DLMM instance.
|
|
2505
|
-
* @returns An array of objects containing binId, amountX, and amountY for each bin.
|
|
2506
|
-
*/
|
|
2507
|
-
declare function toAmountBothSide(activeId: number, binStep: number, amountX: BN, amountY: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, distributions: {
|
|
2508
|
-
binId: number;
|
|
2509
|
-
weight: number;
|
|
2510
|
-
}[]): {
|
|
2511
|
-
binId: number;
|
|
2512
|
-
amountX: BN;
|
|
2513
|
-
amountY: BN;
|
|
2514
|
-
}[];
|
|
2515
|
-
|
|
2516
|
-
declare function withLiquiditySlippage(value: Decimal.Instance, slippage: Decimal.Instance, mode: 'plus' | 'minus'): Decimal;
|
|
2517
|
-
type POOL_NO_LIQUIDITY = -1;
|
|
2518
|
-
type LiquidityAndCoinYResult = {
|
|
2519
|
-
coinYAmount: Decimal;
|
|
2520
|
-
lpAmount: Decimal;
|
|
2521
|
-
};
|
|
2522
|
-
declare function getLiquidityAndCoinYByCoinX(coinInVal: Decimal.Instance, reserveInSize: Decimal.Instance, reserveOutSize: Decimal.Instance, lpSupply: Decimal.Instance): LiquidityAndCoinYResult | POOL_NO_LIQUIDITY;
|
|
2523
|
-
declare function getCoinXYForLiquidity(liquidity: Decimal.Instance, reserveInSize: Decimal.Instance, reserveOutSize: Decimal.Instance, lpSuply: Decimal.Instance): {
|
|
2524
|
-
coinXAmount: Decimal;
|
|
2525
|
-
coinYAmount: Decimal;
|
|
2526
|
-
};
|
|
2527
|
-
|
|
2528
2179
|
/**
|
|
2529
2180
|
* Percentage - the util set for percentage struct.
|
|
2530
2181
|
*/
|
|
@@ -2782,11 +2433,6 @@ declare class SplitSwap {
|
|
|
2782
2433
|
computeSwap(): SplitSwapResult;
|
|
2783
2434
|
}
|
|
2784
2435
|
|
|
2785
|
-
declare class BinMath {
|
|
2786
|
-
static getPriceOfBinByBinId(binId: number, binStep: number, decimalsA: number, decimalsB: number): Decimal;
|
|
2787
|
-
static getBinIdFromPrice(price: string, binStep: number, decimalsA: number, decimalsB: number): number;
|
|
2788
|
-
}
|
|
2789
|
-
|
|
2790
2436
|
type FetchPosRewardParams = {
|
|
2791
2437
|
poolAddress: string;
|
|
2792
2438
|
positionId: string;
|
|
@@ -2913,7 +2559,7 @@ declare class RewarderModule implements IModule {
|
|
|
2913
2559
|
* @param tx
|
|
2914
2560
|
* @returns
|
|
2915
2561
|
*/
|
|
2916
|
-
batchCollectRewardePayload(params: CollectRewarderParams[], tx?: Transaction
|
|
2562
|
+
batchCollectRewardePayload(params: CollectRewarderParams[], tx?: Transaction): Promise<Transaction>;
|
|
2917
2563
|
createCollectRewarderPaylod(params: CollectRewarderParams, tx: Transaction, primaryCoinInputs: TransactionArgument[]): Transaction;
|
|
2918
2564
|
createCollectRewarderNoSendPaylod(params: CollectRewarderParams, tx: Transaction, primaryCoinInputs: TransactionArgument[]): Transaction;
|
|
2919
2565
|
}
|
|
@@ -3726,74 +3372,9 @@ declare class GaugeModule implements IModule {
|
|
|
3726
3372
|
getPoolCoins(pools: string[]): Promise<Map<string, string[]>>;
|
|
3727
3373
|
getEmissions(): Promise<EpochEmission>;
|
|
3728
3374
|
getRewardByPosition(params: GetRewardByPosition): Promise<Transaction>;
|
|
3729
|
-
getAllRewardByPositions(paramsList: GetRewardByPosition[]): Promise<Transaction>;
|
|
3730
3375
|
getEpochRewardByPool(pool: string, incentive_tokens: string[]): Promise<Map<string, string>>;
|
|
3731
3376
|
}
|
|
3732
3377
|
|
|
3733
|
-
declare class DlmmModule implements IModule {
|
|
3734
|
-
protected _sdk: MagmaClmmSDK;
|
|
3735
|
-
private readonly _cache;
|
|
3736
|
-
constructor(sdk: MagmaClmmSDK);
|
|
3737
|
-
get sdk(): MagmaClmmSDK;
|
|
3738
|
-
getPoolInfo(pools: string[]): Promise<DlmmPoolInfo[]>;
|
|
3739
|
-
fetchPairParams(params: FetchPairParams): Promise<EventPairParams>;
|
|
3740
|
-
createPairPayload(params: CreatePairParams): Promise<Transaction>;
|
|
3741
|
-
mintByStrategy(params: MintByStrategyParams): Promise<Transaction>;
|
|
3742
|
-
mintPercent(params: MintPercentParams): Promise<Transaction>;
|
|
3743
|
-
createPositionByAmount(params: MintAmountParams): Promise<Transaction>;
|
|
3744
|
-
addLiquidity(params: DlmmAddLiquidityParams): Promise<Transaction>;
|
|
3745
|
-
private _raisePositionByAmounts;
|
|
3746
|
-
private _raisePositionByAmountsReward;
|
|
3747
|
-
burnPosition(params: DlmmBurnPositionParams): Promise<Transaction>;
|
|
3748
|
-
shrinkPosition(params: DlmmShrinkPosition): Promise<Transaction>;
|
|
3749
|
-
collectFeeAndReward(params: DlmmCollectRewardParams & DlmmCollectFeeParams): Promise<Transaction>;
|
|
3750
|
-
collectReward(params: DlmmCollectRewardParams, transaction?: Transaction): Promise<Transaction>;
|
|
3751
|
-
collectFees(params: DlmmCollectFeeParams, transaction?: Transaction): Promise<Transaction>;
|
|
3752
|
-
createPairAddLiquidity(params: DlmmCreatePairAddLiquidityParams): Promise<Transaction>;
|
|
3753
|
-
swap(params: DLMMSwapParams): Promise<Transaction>;
|
|
3754
|
-
fetchBins(params: FetchBinsParams): Promise<EventBin[]>;
|
|
3755
|
-
/**
|
|
3756
|
-
* Gets a list of positions for the given account address.
|
|
3757
|
-
* @param accountAddress The account address to get positions for.
|
|
3758
|
-
* @param assignPoolIds An array of pool IDs to filter the positions by.
|
|
3759
|
-
* @returns array of Position objects.
|
|
3760
|
-
*/
|
|
3761
|
-
getUserPositionById(positionId: string, showDisplay?: boolean): Promise<DlmmPositionInfo>;
|
|
3762
|
-
/**
|
|
3763
|
-
* Gets a list of positions for the given account address.
|
|
3764
|
-
* @param accountAddress The account address to get positions for.
|
|
3765
|
-
* @param assignPoolIds An array of pool IDs to filter the positions by.
|
|
3766
|
-
* @returns array of Position objects.
|
|
3767
|
-
*/
|
|
3768
|
-
getUserPositions(accountAddress: string, assignPoolIds?: string[], showDisplay?: boolean): Promise<DlmmPositionInfo[]>;
|
|
3769
|
-
private buildPosition;
|
|
3770
|
-
private getPoolCoins;
|
|
3771
|
-
private buildPositionType;
|
|
3772
|
-
getPositionLiquidity(params: GetPositionLiquidityParams): Promise<EventPositionLiquidity>;
|
|
3773
|
-
getPairLiquidity(params: GetPairLiquidityParams): Promise<EventPairLiquidity>;
|
|
3774
|
-
getEarnedFees(params: DlmmCollectFeeParams): Promise<DlmmEventEarnedFees>;
|
|
3775
|
-
getEarnedRewards(params: DlmmRewardsParams): Promise<DlmmEventEarnedRewards>;
|
|
3776
|
-
getPairRewarders(params: GetPairRewarderParams[]): Promise<Map<string, string[]>>;
|
|
3777
|
-
private _getPairRewarders;
|
|
3778
|
-
private _parsePairRewarders;
|
|
3779
|
-
/**
|
|
3780
|
-
* Updates the cache for the given key.
|
|
3781
|
-
*
|
|
3782
|
-
* @param key The key of the cache entry to update.
|
|
3783
|
-
* @param data The data to store in the cache.
|
|
3784
|
-
* @param time The time in minutes after which the cache entry should expire.
|
|
3785
|
-
*/
|
|
3786
|
-
updateCache(key: string, data: SuiResource, time?: number): void;
|
|
3787
|
-
/**
|
|
3788
|
-
* Gets the cache entry for the given key.
|
|
3789
|
-
*
|
|
3790
|
-
* @param key The key of the cache entry to get.
|
|
3791
|
-
* @param forceRefresh Whether to force a refresh of the cache entry.
|
|
3792
|
-
* @returns The cache entry for the given key, or undefined if the cache entry does not exist or is expired.
|
|
3793
|
-
*/
|
|
3794
|
-
getCache<T>(key: string, forceRefresh?: boolean): T | undefined;
|
|
3795
|
-
}
|
|
3796
|
-
|
|
3797
3378
|
/**
|
|
3798
3379
|
* Represents options and configurations for an SDK.
|
|
3799
3380
|
*/
|
|
@@ -3831,7 +3412,6 @@ type SdkOptions = {
|
|
|
3831
3412
|
* Package containing Cryptocurrency Liquidity Mining Module (CLMM) pool configurations.
|
|
3832
3413
|
*/
|
|
3833
3414
|
clmm_pool: Package<ClmmConfig>;
|
|
3834
|
-
dlmm_pool: Package<DlmmConfig>;
|
|
3835
3415
|
distribution: Package;
|
|
3836
3416
|
/**
|
|
3837
3417
|
* Package containing integration-related configurations.
|
|
@@ -3880,7 +3460,6 @@ declare class MagmaClmmSDK {
|
|
|
3880
3460
|
*/
|
|
3881
3461
|
protected _lock: LockModule;
|
|
3882
3462
|
protected _gauge: GaugeModule;
|
|
3883
|
-
protected _dlmm: DlmmModule;
|
|
3884
3463
|
/**
|
|
3885
3464
|
* Provide interact with a position rewarder interface.
|
|
3886
3465
|
*/
|
|
@@ -3928,7 +3507,6 @@ declare class MagmaClmmSDK {
|
|
|
3928
3507
|
get Swap(): SwapModule;
|
|
3929
3508
|
get Lock(): LockModule;
|
|
3930
3509
|
get Gauge(): GaugeModule;
|
|
3931
|
-
get Dlmm(): DlmmModule;
|
|
3932
3510
|
/**
|
|
3933
3511
|
* Getter for the fullClient property.
|
|
3934
3512
|
* @returns {RpcModule} The fullClient property value.
|
|
@@ -4524,4 +4102,4 @@ interface InitMagmaSDKOptions {
|
|
|
4524
4102
|
*/
|
|
4525
4103
|
declare function initMagmaSDK(options: InitMagmaSDKOptions): MagmaClmmSDK;
|
|
4526
4104
|
|
|
4527
|
-
export { AMM_SWAP_MODULE, AddBribeReward, AddLiquidityCommonParams, AddLiquidityFixTokenParams, AddLiquidityParams, AddLiquidityWithProtectionParams, AddressAndDirection, AdjustResult, AggregatorResult, AmountSpecified, BasePath, BigNumber,
|
|
4105
|
+
export { AMM_SWAP_MODULE, AddBribeReward, AddLiquidityCommonParams, AddLiquidityFixTokenParams, AddLiquidityParams, AddLiquidityWithProtectionParams, AddressAndDirection, AdjustResult, AggregatorResult, AmountSpecified, BasePath, BigNumber, Bits, BuildCoinResult, CLOCK_ADDRESS, CachedContent, CalculateRatesParams, CalculateRatesResult, ClaimAndLockParams, ClaimFeesParams, ClaimFeesPoolsParams, ClmmConfig, ClmmExpectSwapModule, ClmmFetcherModule, ClmmIntegratePoolModule, ClmmIntegratePoolV2Module, ClmmIntegratePoolV3Module, ClmmIntegrateRouterModule, ClmmIntegrateRouterWithPartnerModule, ClmmIntegrateUtilsModule, ClmmPartnerModule, ClmmPoolConfig, ClmmPoolUtil, ClmmPositionStatus, ClmmpoolData, ClosePositionParams, CoinAmounts, CoinAsset, CoinAssist, CoinConfig, CoinInfoAddress, CoinNode, CoinPairType, CoinProvider, CoinStoreAddress, CollectFeeParams, CollectFeesQuote, CollectFeesQuoteParam, CollectRewarderParams, ConfigModule, CreateLockParams, CreatePartnerEvent, CreatePoolAddLiquidityParams, CreatePoolParams, DEFAULT_GAS_BUDGET_FOR_MERGE, DEFAULT_GAS_BUDGET_FOR_SPLIT, DEFAULT_GAS_BUDGET_FOR_STAKE, DEFAULT_GAS_BUDGET_FOR_TRANSFER, DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI, DEFAULT_NFT_TRANSFER_GAS_FEE, DataPage, DeepbookClobV2Moudle, DeepbookCustodianV2Moudle, DeepbookEndpointsV2Moudle, DeepbookPool, DeepbookUtils, DepositPosition, EpochEmission, FEE_RATE_DENOMINATOR, FaucetCoin, FetchParams, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, Gauge, GetRewardByPosition, IncreaseLockAmountParams, IncreaseUnlockTimeParams, LaunchpadPoolConfig, LiquidityInput, LockModule, LockPermanentParams, LockVoteEvent, MAX_SQRT_PRICE, MAX_TICK_INDEX, MIN_SQRT_PRICE, MIN_TICK_INDEX, MagmaClmmSDK, MagmaConfigs, MathUtil, MergeLockParams, Minter, NFT, ONE, OnePath, OpenPositionAddLiquidityWithProtectionParams, OpenPositionParams, Order, POOL_STRUCT, Package, PageQuery, PaginationArgs, PathLink, PathProvider, Percentage, PokeParams, Pool, PoolImmutables, PoolInfo, PoolModule, Position, PositionModule, PositionReward, PositionStatus, PositionUtil, PreRouterSwapParams, PreSwapLpChangeParams, PreSwapParams, PreSwapResult, PreSwapWithMultiPoolParams, PriceResult, RemoveLiquidityParams, RewardDistributor, Rewarder, RewarderAmountOwed, RouterModule, RouterModuleV2, RpcModule, SUI_SYSTEM_STATE_OBJECT_ID, SdkOptions, SplitPath, SplitSwap, SplitSwapResult, SplitUnit, StakedPositionOfPool, SuiAddressType, SuiBasicTypes, SuiInputTypes, SuiObjectDataWithContent, SuiObjectIdType, SuiResource, SuiStructTag, SuiTxArg, SwapDirection, SwapModule, SwapParams, SwapResult, SwapStepResult, SwapUtils, SwapWithRouterParams, TICK_ARRAY_SIZE, TWO, Tick, TickData, TickMath, TickUtil, TokenConfig, TokenConfigEvent, TokenInfo, TokenModule, TransPreSwapWithMultiPoolParams, TransactionUtil, TransferLockParams, TxBlock, U128, U128_MAX, U64_MAX, VoteParams, Voter, VotingEscrow, WithdrawPosition, ZERO, addHexPrefix, adjustForCoinSlippage, adjustForSlippage, asIntN, asUintN, bufferToHex, buildClmmPositionName, buildNFT, buildPool, buildPosition, buildPositionReward, buildTickData, buildTickDataByEvent, cacheTime24h, cacheTime5min, checkAddress, checkInvalidSuiAddress, clmmMainnet, clmmTestnet, collectFeesQuote, composeType, computeSwap, computeSwapStep, createSplitAmountArray, createSplitArray, createTestTransferTxPayloadParams, d, decimalsMultiplier, MagmaClmmSDK as default, estPoolAPR, estPosAPRResult, estPositionAPRWithDeltaMethod, estPositionAPRWithMultiMethod, estimateLiquidityForCoinA, estimateLiquidityForCoinB, extractAddressFromType, extractStructTagFromType, findAdjustCoin, fixCoinType, fixSuiObjectId, fromDecimalsAmount, getAmountFixedDelta, getAmountUnfixedDelta, getCoinAFromLiquidity, getCoinBFromLiquidity, getDefaultSuiInputType, getDeltaA, getDeltaB, getDeltaDownFromOutput, getDeltaUpFromInput, getFutureTime, getLiquidityFromCoinA, getLiquidityFromCoinB, getLowerSqrtPriceFromCoinA, getLowerSqrtPriceFromCoinB, getMoveObject, getMoveObjectType, getMovePackageContent, getNearestTickByTick, getNextSqrtPriceAUp, getNextSqrtPriceBDown, getNextSqrtPriceFromInput, getNextSqrtPriceFromOutput, getObjectDeletedResponse, getObjectDisplay, getObjectFields, getObjectId, getObjectNotExistsResponse, getObjectOwner, getObjectPreviousTransactionDigest, getObjectReference, getObjectType, getObjectVersion, getPackagerConfigs, getRewardInTickRange, getSuiObjectData, getTickDataFromUrlData, getUpperSqrtPriceFromCoinA, getUpperSqrtPriceFromCoinB, hasPublicTransfer, hexToNumber, hexToString, initMagmaSDK, initMainnetSDK, initTestnetSDK, isSortedSymbols, isSuiObjectResponse, newBits, normalizeCoinType, patchFixSuiObjectId, printTransaction, removeHexPrefix, secretKeyToEd25519Keypair, secretKeyToSecp256k1Keypair, shortAddress, shortString, tickScore, toBuffer, toCoinAmount, toDecimalsAmount, transClmmpoolDataWithoutTicks, utf8to16 };
|