@magmaprotocol/magma-clmm-sdk 0.5.77 → 0.5.79
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 +10 -6
- package/dist/index.d.ts +427 -1
- package/dist/index.js +1658 -190
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1646 -188
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
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="https://app.magmafinance.io/magma.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({network: 'mainnet'})
|
|
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,24 +51,28 @@ 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({network, fullNodeUrl, simulationAccount})
|
|
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
|
+
|
|
63
64
|
You can view this typescript sdk in
|
|
64
65
|
<a href="https://github.com/MagmaFinanceIO/magma_sdk_doc"><strong> Magma Development Documents. </strong></a>
|
|
65
66
|
<br />
|
|
66
67
|
|
|
67
68
|
## LICENSE
|
|
69
|
+
|
|
68
70
|
MAGMA-CLMM-SDK released under the Apache license. See the [LICENSE](./LICENSE) file for details.
|
|
69
71
|
|
|
70
72
|
## More About Magma
|
|
73
|
+
|
|
71
74
|
Use the following links to learn more about Magma:
|
|
75
|
+
|
|
72
76
|
- [ ] Learn more about working with Magma in the [Magma Documentation]().
|
|
73
77
|
|
|
74
78
|
- [ ] Join the Magma community on [Magma Discord]().
|
package/dist/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ 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";
|
|
40
41
|
/**
|
|
41
42
|
* The address for CoinInfo module.
|
|
42
43
|
*/
|
|
@@ -451,6 +452,9 @@ type ClmmConfig = {
|
|
|
451
452
|
*/
|
|
452
453
|
partners_id?: SuiObjectIdType;
|
|
453
454
|
};
|
|
455
|
+
type DlmmConfig = {
|
|
456
|
+
factory: SuiObjectIdType;
|
|
457
|
+
};
|
|
454
458
|
/**
|
|
455
459
|
* Represents an event to create a liquidity mining partner.
|
|
456
460
|
*/
|
|
@@ -1628,6 +1632,243 @@ type GetRewardByPosition = {
|
|
|
1628
1632
|
coinTypeB: string;
|
|
1629
1633
|
};
|
|
1630
1634
|
|
|
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
|
+
real_bin_id: number;
|
|
1756
|
+
coinAmountA: string;
|
|
1757
|
+
coinAmountB: string;
|
|
1758
|
+
index?: number;
|
|
1759
|
+
};
|
|
1760
|
+
type DlmmAddLiquidityParams = {
|
|
1761
|
+
pool_id: string;
|
|
1762
|
+
coin_a: string;
|
|
1763
|
+
coin_b: string;
|
|
1764
|
+
position_id: string;
|
|
1765
|
+
amounts_a: number[];
|
|
1766
|
+
amounts_b: number[];
|
|
1767
|
+
receiver: string;
|
|
1768
|
+
rewards_token: string[];
|
|
1769
|
+
};
|
|
1770
|
+
type DlmmBurnPositionParams = {
|
|
1771
|
+
pool_id: string;
|
|
1772
|
+
position_id: string;
|
|
1773
|
+
coin_a: string;
|
|
1774
|
+
coin_b: string;
|
|
1775
|
+
rewards_token: string[];
|
|
1776
|
+
};
|
|
1777
|
+
type DlmmShrinkPosition = {
|
|
1778
|
+
pool_id: string;
|
|
1779
|
+
position_id: string;
|
|
1780
|
+
coin_a: string;
|
|
1781
|
+
coin_b: string;
|
|
1782
|
+
delta_percentage: number;
|
|
1783
|
+
rewards_token: string[];
|
|
1784
|
+
};
|
|
1785
|
+
type DlmmCollectRewardParams = {
|
|
1786
|
+
pool_id: string;
|
|
1787
|
+
coin_a: string;
|
|
1788
|
+
coin_b: string;
|
|
1789
|
+
position_id: string;
|
|
1790
|
+
rewards_token: string[];
|
|
1791
|
+
};
|
|
1792
|
+
type DlmmCollectFeeParams = {
|
|
1793
|
+
pool_id: string;
|
|
1794
|
+
coin_a: string;
|
|
1795
|
+
coin_b: string;
|
|
1796
|
+
position_id: string;
|
|
1797
|
+
};
|
|
1798
|
+
type DlmmRewardsParams = {
|
|
1799
|
+
pool_id: string;
|
|
1800
|
+
position_id: string;
|
|
1801
|
+
coin_a: string;
|
|
1802
|
+
coin_b: string;
|
|
1803
|
+
rewards_token: string[];
|
|
1804
|
+
};
|
|
1805
|
+
type DlmmEventEarnedFees = {
|
|
1806
|
+
position_id: string;
|
|
1807
|
+
x: string;
|
|
1808
|
+
y: string;
|
|
1809
|
+
fee_x: number;
|
|
1810
|
+
fee_y: number;
|
|
1811
|
+
};
|
|
1812
|
+
type DlmmEventEarnedRewards = {
|
|
1813
|
+
position_id: string;
|
|
1814
|
+
reward: string[];
|
|
1815
|
+
amount: number[];
|
|
1816
|
+
};
|
|
1817
|
+
type GetPairRewarderParams = {
|
|
1818
|
+
pool_id: string;
|
|
1819
|
+
coin_a: string;
|
|
1820
|
+
coin_b: string;
|
|
1821
|
+
};
|
|
1822
|
+
type DlmmEventPairRewardTypes = {
|
|
1823
|
+
pair_id: string;
|
|
1824
|
+
tokens: string[];
|
|
1825
|
+
};
|
|
1826
|
+
type BinDisplay = {
|
|
1827
|
+
binId: number;
|
|
1828
|
+
amountX: BN;
|
|
1829
|
+
amountY: BN;
|
|
1830
|
+
};
|
|
1831
|
+
type DlmmCreatePairAddLiquidityParams = {
|
|
1832
|
+
baseFee: number;
|
|
1833
|
+
binStep: number;
|
|
1834
|
+
coinTypeA: string;
|
|
1835
|
+
coinTypeB: string;
|
|
1836
|
+
activeId: number;
|
|
1837
|
+
realIds: number[];
|
|
1838
|
+
amountsX: number[];
|
|
1839
|
+
amountsY: number[];
|
|
1840
|
+
to: string;
|
|
1841
|
+
};
|
|
1842
|
+
type DlmmPosition = {
|
|
1843
|
+
pos_object_id: SuiObjectIdType;
|
|
1844
|
+
owner: SuiObjectIdType;
|
|
1845
|
+
pool: SuiObjectIdType;
|
|
1846
|
+
type: SuiAddressType;
|
|
1847
|
+
bin_real_ids: number[];
|
|
1848
|
+
};
|
|
1849
|
+
type DlmmPositionInfo = {
|
|
1850
|
+
position: DlmmPosition;
|
|
1851
|
+
liquidity: EventPositionLiquidity;
|
|
1852
|
+
rewards: DlmmEventEarnedRewards;
|
|
1853
|
+
fees: DlmmEventEarnedFees;
|
|
1854
|
+
contractPool: DlmmPoolInfo | undefined;
|
|
1855
|
+
};
|
|
1856
|
+
type MintByStrategyParams = {
|
|
1857
|
+
pair: string;
|
|
1858
|
+
bin_step: number;
|
|
1859
|
+
coinTypeA: string;
|
|
1860
|
+
coinTypeB: string;
|
|
1861
|
+
amountATotal: number;
|
|
1862
|
+
amountBTotal: number;
|
|
1863
|
+
fixCoinA: boolean;
|
|
1864
|
+
fixCoinB: boolean;
|
|
1865
|
+
strategy: number;
|
|
1866
|
+
min_bin: number;
|
|
1867
|
+
max_bin: number;
|
|
1868
|
+
active_bin: number;
|
|
1869
|
+
slippage: number;
|
|
1870
|
+
};
|
|
1871
|
+
|
|
1631
1872
|
type BigNumber = Decimal.Value | number | string;
|
|
1632
1873
|
|
|
1633
1874
|
interface IModule {
|
|
@@ -2176,6 +2417,118 @@ type CollectFeesQuote = {
|
|
|
2176
2417
|
*/
|
|
2177
2418
|
declare function collectFeesQuote(param: CollectFeesQuoteParam): CollectFeesQuote;
|
|
2178
2419
|
|
|
2420
|
+
declare enum StrategyType {
|
|
2421
|
+
Spot = 1,
|
|
2422
|
+
Curve = 2,
|
|
2423
|
+
BidAsk = 3
|
|
2424
|
+
}
|
|
2425
|
+
type BinLiquidity = {
|
|
2426
|
+
ActiveId: number;
|
|
2427
|
+
StorageId: number;
|
|
2428
|
+
Price: number;
|
|
2429
|
+
CoinAType: number;
|
|
2430
|
+
CoinBType: number;
|
|
2431
|
+
CoinAAmount: number;
|
|
2432
|
+
CoinBAmount: number;
|
|
2433
|
+
};
|
|
2434
|
+
declare function autoFillYByStrategy(activeId: number, binStep: number, amountX: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, minBinId: number, maxBinId: number, strategyType: StrategyType): BN;
|
|
2435
|
+
declare function autoFillXByStrategy(activeId: number, binStep: number, amountY: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, minBinId: number, maxBinId: number, strategyType: StrategyType): BN;
|
|
2436
|
+
/**
|
|
2437
|
+
* Given a strategy type and amounts of X and Y, returns the distribution of liquidity.
|
|
2438
|
+
* @param activeId The bin id of the active bin.
|
|
2439
|
+
* @param binStep The step size of each bin.
|
|
2440
|
+
* @param minBinId The min bin id.
|
|
2441
|
+
* @param maxBinId The max bin id.
|
|
2442
|
+
* @param amountX The amount of X token to deposit.
|
|
2443
|
+
* @param amountY The amount of Y token to deposit.
|
|
2444
|
+
* @param amountXInActiveBin The amount of X token in the active bin.
|
|
2445
|
+
* @param amountYInActiveBin The amount of Y token in the active bin.
|
|
2446
|
+
* @param strategyType The strategy type.
|
|
2447
|
+
* @param mintX The mint info of X token. Get from DLMM instance.
|
|
2448
|
+
* @param mintY The mint info of Y token. Get from DLMM instance.
|
|
2449
|
+
* @param clock The clock info. Get from DLMM instance.
|
|
2450
|
+
* @returns The distribution of liquidity.
|
|
2451
|
+
*/
|
|
2452
|
+
declare function toAmountsBothSideByStrategy(activeId: number, binStep: number, minBinId: number, maxBinId: number, amountX: BN, amountY: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, strategyType: StrategyType): BinDisplay[];
|
|
2453
|
+
|
|
2454
|
+
declare function getPriceOfBinByBinId(binId: number, binStep: number): Decimal;
|
|
2455
|
+
declare function autoFillYByWeight(activeId: number, binStep: number, amountX: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, distributions: {
|
|
2456
|
+
binId: number;
|
|
2457
|
+
weight: number;
|
|
2458
|
+
}[]): BN;
|
|
2459
|
+
declare function autoFillXByWeight(activeId: number, binStep: number, amountY: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, distributions: {
|
|
2460
|
+
binId: number;
|
|
2461
|
+
weight: number;
|
|
2462
|
+
}[]): BN;
|
|
2463
|
+
/**
|
|
2464
|
+
* Distribute totalAmount to all bid side bins according to given distributions.
|
|
2465
|
+
* @param activeId active bin id
|
|
2466
|
+
* @param totalAmount total amount of token Y to be distributed
|
|
2467
|
+
* @param distributions weight distribution of each bin
|
|
2468
|
+
* @param mintY mint of token Y, get from DLMM instance
|
|
2469
|
+
* @param clock clock of the program, for calculating transfer fee, get from DLMM instance
|
|
2470
|
+
* @returns array of {binId, amount} where amount is the amount of token Y in each bin
|
|
2471
|
+
*/
|
|
2472
|
+
declare function toAmountBidSide(activeId: number, totalAmount: BN, distributions: {
|
|
2473
|
+
binId: number;
|
|
2474
|
+
weight: number;
|
|
2475
|
+
}[]): {
|
|
2476
|
+
binId: number;
|
|
2477
|
+
amount: BN;
|
|
2478
|
+
}[];
|
|
2479
|
+
/**
|
|
2480
|
+
* Distribute totalAmount to all ask side bins according to given distributions.
|
|
2481
|
+
* @param activeId active bin id
|
|
2482
|
+
* @param totalAmount total amount of token Y to be distributed
|
|
2483
|
+
* @param distributions weight distribution of each bin
|
|
2484
|
+
* @param mintX mint of token X, get from DLMM instance
|
|
2485
|
+
* @param clock clock of the program, for calculating transfer fee, get from DLMM instance
|
|
2486
|
+
* @returns array of {binId, amount} where amount is the amount of token X in each bin
|
|
2487
|
+
*/
|
|
2488
|
+
declare function toAmountAskSide(activeId: number, binStep: number, totalAmount: BN, distributions: {
|
|
2489
|
+
binId: number;
|
|
2490
|
+
weight: number;
|
|
2491
|
+
}[]): {
|
|
2492
|
+
binId: number;
|
|
2493
|
+
amount: BN;
|
|
2494
|
+
}[];
|
|
2495
|
+
/**
|
|
2496
|
+
* Distributes the given amounts of tokens X and Y to both bid and ask side bins
|
|
2497
|
+
* based on the provided weight distributions.
|
|
2498
|
+
*
|
|
2499
|
+
* @param activeId - The id of the active bin.
|
|
2500
|
+
* @param binStep - The step interval between bin ids.
|
|
2501
|
+
* @param amountX - Total amount of token X to distribute.
|
|
2502
|
+
* @param amountY - Total amount of token Y to distribute.
|
|
2503
|
+
* @param amountXInActiveBin - Amount of token X already in the active bin.
|
|
2504
|
+
* @param amountYInActiveBin - Amount of token Y already in the active bin.
|
|
2505
|
+
* @param distributions - Array of bins with their respective weight distributions.
|
|
2506
|
+
* @param mintX - Mint information for token X. Get from DLMM instance.
|
|
2507
|
+
* @param mintY - Mint information for token Y. Get from DLMM instance.
|
|
2508
|
+
* @param clock - Clock instance. Get from DLMM instance.
|
|
2509
|
+
* @returns An array of objects containing binId, amountX, and amountY for each bin.
|
|
2510
|
+
*/
|
|
2511
|
+
declare function toAmountBothSide(activeId: number, binStep: number, amountX: BN, amountY: BN, amountXInActiveBin: BN, amountYInActiveBin: BN, distributions: {
|
|
2512
|
+
binId: number;
|
|
2513
|
+
weight: number;
|
|
2514
|
+
}[]): {
|
|
2515
|
+
binId: number;
|
|
2516
|
+
amountX: BN;
|
|
2517
|
+
amountY: BN;
|
|
2518
|
+
}[];
|
|
2519
|
+
|
|
2520
|
+
declare function withLiquiditySlippage(value: Decimal.Instance, slippage: Decimal.Instance, mode: 'plus' | 'minus'): Decimal;
|
|
2521
|
+
type POOL_NO_LIQUIDITY = -1;
|
|
2522
|
+
type LiquidityAndCoinYResult = {
|
|
2523
|
+
coinYAmount: Decimal;
|
|
2524
|
+
lpAmount: Decimal;
|
|
2525
|
+
};
|
|
2526
|
+
declare function getLiquidityAndCoinYByCoinX(coinInVal: Decimal.Instance, reserveInSize: Decimal.Instance, reserveOutSize: Decimal.Instance, lpSupply: Decimal.Instance): LiquidityAndCoinYResult | POOL_NO_LIQUIDITY;
|
|
2527
|
+
declare function getCoinXYForLiquidity(liquidity: Decimal.Instance, reserveInSize: Decimal.Instance, reserveOutSize: Decimal.Instance, lpSuply: Decimal.Instance): {
|
|
2528
|
+
coinXAmount: Decimal;
|
|
2529
|
+
coinYAmount: Decimal;
|
|
2530
|
+
};
|
|
2531
|
+
|
|
2179
2532
|
/**
|
|
2180
2533
|
* Percentage - the util set for percentage struct.
|
|
2181
2534
|
*/
|
|
@@ -2433,6 +2786,11 @@ declare class SplitSwap {
|
|
|
2433
2786
|
computeSwap(): SplitSwapResult;
|
|
2434
2787
|
}
|
|
2435
2788
|
|
|
2789
|
+
declare class BinMath {
|
|
2790
|
+
static getPriceOfBinByBinId(binId: number, binStep: number, decimalsA: number, decimalsB: number): Decimal;
|
|
2791
|
+
static getBinIdFromPrice(price: string, binStep: number, decimalsA: number, decimalsB: number): number;
|
|
2792
|
+
}
|
|
2793
|
+
|
|
2436
2794
|
type FetchPosRewardParams = {
|
|
2437
2795
|
poolAddress: string;
|
|
2438
2796
|
positionId: string;
|
|
@@ -3372,9 +3730,74 @@ declare class GaugeModule implements IModule {
|
|
|
3372
3730
|
getPoolCoins(pools: string[]): Promise<Map<string, string[]>>;
|
|
3373
3731
|
getEmissions(): Promise<EpochEmission>;
|
|
3374
3732
|
getRewardByPosition(params: GetRewardByPosition): Promise<Transaction>;
|
|
3733
|
+
getAllRewardByPositions(paramsList: GetRewardByPosition[]): Promise<Transaction>;
|
|
3375
3734
|
getEpochRewardByPool(pool: string, incentive_tokens: string[]): Promise<Map<string, string>>;
|
|
3376
3735
|
}
|
|
3377
3736
|
|
|
3737
|
+
declare class DlmmModule implements IModule {
|
|
3738
|
+
protected _sdk: MagmaClmmSDK;
|
|
3739
|
+
private readonly _cache;
|
|
3740
|
+
constructor(sdk: MagmaClmmSDK);
|
|
3741
|
+
get sdk(): MagmaClmmSDK;
|
|
3742
|
+
getPoolInfo(pools: string[]): Promise<DlmmPoolInfo[]>;
|
|
3743
|
+
fetchPairParams(params: FetchPairParams): Promise<EventPairParams>;
|
|
3744
|
+
createPairPayload(params: CreatePairParams): Promise<Transaction>;
|
|
3745
|
+
mintByStrategy(params: MintByStrategyParams): Promise<Transaction>;
|
|
3746
|
+
mintPercent(params: MintPercentParams): Promise<Transaction>;
|
|
3747
|
+
createPositionByAmount(params: MintAmountParams): Promise<Transaction>;
|
|
3748
|
+
addLiquidity(params: DlmmAddLiquidityParams): Promise<Transaction>;
|
|
3749
|
+
private _raisePositionByAmounts;
|
|
3750
|
+
private _raisePositionByAmountsReward;
|
|
3751
|
+
burnPosition(params: DlmmBurnPositionParams): Promise<Transaction>;
|
|
3752
|
+
shrinkPosition(params: DlmmShrinkPosition): Promise<Transaction>;
|
|
3753
|
+
collectFeeAndReward(params: DlmmCollectRewardParams & DlmmCollectFeeParams): Promise<Transaction>;
|
|
3754
|
+
collectReward(params: DlmmCollectRewardParams, transaction?: Transaction): Promise<Transaction>;
|
|
3755
|
+
collectFees(params: DlmmCollectFeeParams, transaction?: Transaction): Promise<Transaction>;
|
|
3756
|
+
createPairAddLiquidity(params: DlmmCreatePairAddLiquidityParams): Promise<Transaction>;
|
|
3757
|
+
swap(params: DLMMSwapParams): Promise<Transaction>;
|
|
3758
|
+
fetchBins(params: FetchBinsParams): Promise<EventBin[]>;
|
|
3759
|
+
/**
|
|
3760
|
+
* Gets a list of positions for the given account address.
|
|
3761
|
+
* @param accountAddress The account address to get positions for.
|
|
3762
|
+
* @param assignPoolIds An array of pool IDs to filter the positions by.
|
|
3763
|
+
* @returns array of Position objects.
|
|
3764
|
+
*/
|
|
3765
|
+
getUserPositionById(positionId: string, showDisplay?: boolean): Promise<DlmmPositionInfo>;
|
|
3766
|
+
/**
|
|
3767
|
+
* Gets a list of positions for the given account address.
|
|
3768
|
+
* @param accountAddress The account address to get positions for.
|
|
3769
|
+
* @param assignPoolIds An array of pool IDs to filter the positions by.
|
|
3770
|
+
* @returns array of Position objects.
|
|
3771
|
+
*/
|
|
3772
|
+
getUserPositions(accountAddress: string, assignPoolIds?: string[], showDisplay?: boolean): Promise<DlmmPositionInfo[]>;
|
|
3773
|
+
private buildPosition;
|
|
3774
|
+
private getPoolCoins;
|
|
3775
|
+
private buildPositionType;
|
|
3776
|
+
getPositionLiquidity(params: GetPositionLiquidityParams): Promise<EventPositionLiquidity>;
|
|
3777
|
+
getPairLiquidity(params: GetPairLiquidityParams): Promise<EventPairLiquidity>;
|
|
3778
|
+
getEarnedFees(params: DlmmCollectFeeParams): Promise<DlmmEventEarnedFees>;
|
|
3779
|
+
getEarnedRewards(params: DlmmRewardsParams): Promise<DlmmEventEarnedRewards>;
|
|
3780
|
+
getPairRewarders(params: GetPairRewarderParams[]): Promise<Map<string, string[]>>;
|
|
3781
|
+
private _getPairRewarders;
|
|
3782
|
+
private _parsePairRewarders;
|
|
3783
|
+
/**
|
|
3784
|
+
* Updates the cache for the given key.
|
|
3785
|
+
*
|
|
3786
|
+
* @param key The key of the cache entry to update.
|
|
3787
|
+
* @param data The data to store in the cache.
|
|
3788
|
+
* @param time The time in minutes after which the cache entry should expire.
|
|
3789
|
+
*/
|
|
3790
|
+
updateCache(key: string, data: SuiResource, time?: number): void;
|
|
3791
|
+
/**
|
|
3792
|
+
* Gets the cache entry for the given key.
|
|
3793
|
+
*
|
|
3794
|
+
* @param key The key of the cache entry to get.
|
|
3795
|
+
* @param forceRefresh Whether to force a refresh of the cache entry.
|
|
3796
|
+
* @returns The cache entry for the given key, or undefined if the cache entry does not exist or is expired.
|
|
3797
|
+
*/
|
|
3798
|
+
getCache<T>(key: string, forceRefresh?: boolean): T | undefined;
|
|
3799
|
+
}
|
|
3800
|
+
|
|
3378
3801
|
/**
|
|
3379
3802
|
* Represents options and configurations for an SDK.
|
|
3380
3803
|
*/
|
|
@@ -3412,6 +3835,7 @@ type SdkOptions = {
|
|
|
3412
3835
|
* Package containing Cryptocurrency Liquidity Mining Module (CLMM) pool configurations.
|
|
3413
3836
|
*/
|
|
3414
3837
|
clmm_pool: Package<ClmmConfig>;
|
|
3838
|
+
dlmm_pool: Package<DlmmConfig>;
|
|
3415
3839
|
distribution: Package;
|
|
3416
3840
|
/**
|
|
3417
3841
|
* Package containing integration-related configurations.
|
|
@@ -3460,6 +3884,7 @@ declare class MagmaClmmSDK {
|
|
|
3460
3884
|
*/
|
|
3461
3885
|
protected _lock: LockModule;
|
|
3462
3886
|
protected _gauge: GaugeModule;
|
|
3887
|
+
protected _dlmm: DlmmModule;
|
|
3463
3888
|
/**
|
|
3464
3889
|
* Provide interact with a position rewarder interface.
|
|
3465
3890
|
*/
|
|
@@ -3507,6 +3932,7 @@ declare class MagmaClmmSDK {
|
|
|
3507
3932
|
get Swap(): SwapModule;
|
|
3508
3933
|
get Lock(): LockModule;
|
|
3509
3934
|
get Gauge(): GaugeModule;
|
|
3935
|
+
get Dlmm(): DlmmModule;
|
|
3510
3936
|
/**
|
|
3511
3937
|
* Getter for the fullClient property.
|
|
3512
3938
|
* @returns {RpcModule} The fullClient property value.
|
|
@@ -4102,4 +4528,4 @@ interface InitMagmaSDKOptions {
|
|
|
4102
4528
|
*/
|
|
4103
4529
|
declare function initMagmaSDK(options: InitMagmaSDKOptions): MagmaClmmSDK;
|
|
4104
4530
|
|
|
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 };
|
|
4531
|
+
export { AMM_SWAP_MODULE, AddBribeReward, AddLiquidityCommonParams, AddLiquidityFixTokenParams, AddLiquidityParams, AddLiquidityWithProtectionParams, AddressAndDirection, AdjustResult, AggregatorResult, AmountSpecified, BasePath, BigNumber, BinDisplay, BinLiquidity, BinMath, 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, CreatePairParams, 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, DLMMSwapParams, DataPage, DeepbookClobV2Moudle, DeepbookCustodianV2Moudle, DeepbookEndpointsV2Moudle, DeepbookPool, DeepbookUtils, DepositPosition, DlmmAddLiquidityParams, DlmmBurnPositionParams, DlmmCollectFeeParams, DlmmCollectRewardParams, DlmmConfig, DlmmCreatePairAddLiquidityParams, DlmmEventEarnedFees, DlmmEventEarnedRewards, DlmmEventPairRewardTypes, DlmmPoolInfo, DlmmPosition, DlmmPositionInfo, DlmmRewardsParams, DlmmScript, DlmmShrinkPosition, EpochEmission, EventBin, EventPairLiquidity, EventPairParams, EventPositionLiquidity, FEE_RATE_DENOMINATOR, FaucetCoin, FetchBinsParams, FetchPairParams, FetchParams, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, Gauge, GetPairLiquidityParams, GetPairRewarderParams, GetPositionLiquidityParams, GetRewardByPosition, IncreaseLockAmountParams, IncreaseUnlockTimeParams, LaunchpadPoolConfig, LiquidityAndCoinYResult, LiquidityInput, LockModule, LockPermanentParams, LockVoteEvent, MAX_SQRT_PRICE, MAX_TICK_INDEX, MIN_SQRT_PRICE, MIN_TICK_INDEX, MagmaClmmSDK, MagmaConfigs, MathUtil, MergeLockParams, MintAmountParams, MintByStrategyParams, MintPercentParams, Minter, NFT, ONE, OnePath, OpenPositionAddLiquidityWithProtectionParams, OpenPositionParams, Order, POOL_NO_LIQUIDITY, 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, StrategyType, 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, autoFillXByStrategy, autoFillXByWeight, autoFillYByStrategy, autoFillYByWeight, 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, getCoinXYForLiquidity, getDefaultSuiInputType, getDeltaA, getDeltaB, getDeltaDownFromOutput, getDeltaUpFromInput, getFutureTime, getLiquidityAndCoinYByCoinX, getLiquidityFromCoinA, getLiquidityFromCoinB, getLowerSqrtPriceFromCoinA, getLowerSqrtPriceFromCoinB, getMoveObject, getMoveObjectType, getMovePackageContent, getNearestTickByTick, getNextSqrtPriceAUp, getNextSqrtPriceBDown, getNextSqrtPriceFromInput, getNextSqrtPriceFromOutput, getObjectDeletedResponse, getObjectDisplay, getObjectFields, getObjectId, getObjectNotExistsResponse, getObjectOwner, getObjectPreviousTransactionDigest, getObjectReference, getObjectType, getObjectVersion, getPackagerConfigs, getPriceOfBinByBinId, getRewardInTickRange, getSuiObjectData, getTickDataFromUrlData, getUpperSqrtPriceFromCoinA, getUpperSqrtPriceFromCoinB, hasPublicTransfer, hexToNumber, hexToString, initMagmaSDK, initMainnetSDK, initTestnetSDK, isSortedSymbols, isSuiObjectResponse, newBits, normalizeCoinType, patchFixSuiObjectId, printTransaction, removeHexPrefix, secretKeyToEd25519Keypair, secretKeyToSecp256k1Keypair, shortAddress, shortString, tickScore, toAmountAskSide, toAmountBidSide, toAmountBothSide, toAmountsBothSideByStrategy, toBuffer, toCoinAmount, toDecimalsAmount, transClmmpoolDataWithoutTicks, utf8to16, withLiquiditySlippage };
|