@mysten/deepbook-v3 1.6.6 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/_virtual/rolldown_runtime.mjs +18 -0
  3. package/dist/client.d.mts +11 -8
  4. package/dist/client.d.mts.map +1 -1
  5. package/dist/client.mjs +3 -2
  6. package/dist/client.mjs.map +1 -1
  7. package/dist/contracts/deepbook/account.d.mts +18 -18
  8. package/dist/contracts/deepbook/account.d.mts.map +1 -1
  9. package/dist/contracts/deepbook/balances.d.mts +4 -4
  10. package/dist/contracts/deepbook/balances.d.mts.map +1 -1
  11. package/dist/contracts/deepbook/deep_price.d.mts +3 -3
  12. package/dist/contracts/deepbook/deep_price.d.mts.map +1 -1
  13. package/dist/contracts/deepbook_margin/margin_manager.mjs +1 -319
  14. package/dist/contracts/deepbook_margin/margin_manager.mjs.map +1 -1
  15. package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs +386 -0
  16. package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs.map +1 -0
  17. package/dist/contracts/deepbook_margin/oracle.mjs +9 -0
  18. package/dist/contracts/deepbook_margin/oracle.mjs.map +1 -1
  19. package/dist/contracts/deepbook_margin/pool_proxy.mjs +1 -383
  20. package/dist/contracts/deepbook_margin/pool_proxy.mjs.map +1 -1
  21. package/dist/contracts/deepbook_margin/pool_proxy_upgraded.mjs +340 -0
  22. package/dist/contracts/deepbook_margin/pool_proxy_upgraded.mjs.map +1 -0
  23. package/dist/contracts/margin_liquidation/liquidation_vault.mjs +33 -17
  24. package/dist/contracts/margin_liquidation/liquidation_vault.mjs.map +1 -1
  25. package/dist/index.d.mts +4 -3
  26. package/dist/index.mjs +2 -2
  27. package/dist/pyth/PriceServiceConnection.d.mts +18 -3
  28. package/dist/pyth/PriceServiceConnection.d.mts.map +1 -1
  29. package/dist/pyth/PriceServiceConnection.mjs +35 -4
  30. package/dist/pyth/PriceServiceConnection.mjs.map +1 -1
  31. package/dist/queries/priceFeedQueries.mjs +50 -18
  32. package/dist/queries/priceFeedQueries.mjs.map +1 -1
  33. package/dist/transactions/balanceManager.d.mts +12 -12
  34. package/dist/transactions/deepbook.d.mts +20 -20
  35. package/dist/transactions/deepbookAdmin.d.mts +4 -4
  36. package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
  37. package/dist/transactions/marginAdmin.d.mts +7 -7
  38. package/dist/transactions/marginAdmin.d.mts.map +1 -1
  39. package/dist/transactions/marginAdmin.mjs +2 -2
  40. package/dist/transactions/marginAdmin.mjs.map +1 -1
  41. package/dist/transactions/marginLiquidations.d.mts +3 -3
  42. package/dist/transactions/marginLiquidations.d.mts.map +1 -1
  43. package/dist/transactions/marginLiquidations.mjs +19 -7
  44. package/dist/transactions/marginLiquidations.mjs.map +1 -1
  45. package/dist/transactions/marginMaintainer.d.mts +5 -5
  46. package/dist/transactions/marginManager.d.mts +32 -32
  47. package/dist/transactions/marginManager.d.mts.map +1 -1
  48. package/dist/transactions/marginManager.mjs +43 -34
  49. package/dist/transactions/marginManager.mjs.map +1 -1
  50. package/dist/transactions/marginPool.d.mts +18 -18
  51. package/dist/transactions/marginRegistry.d.mts +16 -16
  52. package/dist/transactions/marginTPSL.d.mts +10 -10
  53. package/dist/transactions/marginTPSL.d.mts.map +1 -1
  54. package/dist/transactions/marginTPSL.mjs +19 -10
  55. package/dist/transactions/marginTPSL.mjs.map +1 -1
  56. package/dist/transactions/poolProxy.d.mts.map +1 -1
  57. package/dist/transactions/poolProxy.mjs +34 -27
  58. package/dist/transactions/poolProxy.mjs.map +1 -1
  59. package/dist/types/index.d.mts +16 -1
  60. package/dist/types/index.d.mts.map +1 -1
  61. package/dist/types/index.mjs.map +1 -1
  62. package/dist/utils/config.d.mts +30 -10
  63. package/dist/utils/config.d.mts.map +1 -1
  64. package/dist/utils/config.mjs +33 -4
  65. package/dist/utils/config.mjs.map +1 -1
  66. package/dist/utils/constants.d.mts +32 -1
  67. package/dist/utils/constants.d.mts.map +1 -1
  68. package/dist/utils/constants.mjs +54 -23
  69. package/dist/utils/constants.mjs.map +1 -1
  70. package/package.json +2 -2
  71. package/src/client.ts +9 -1
  72. package/src/contracts/deepbook_margin/margin_manager.ts +140 -10
  73. package/src/contracts/deepbook_margin/margin_manager_upgraded.ts +651 -0
  74. package/src/contracts/deepbook_margin/oracle.ts +59 -0
  75. package/src/contracts/deepbook_margin/pool_proxy.ts +600 -584
  76. package/src/contracts/deepbook_margin/pool_proxy_upgraded.ts +614 -0
  77. package/src/contracts/margin_liquidation/liquidation_vault.ts +142 -0
  78. package/src/index.ts +4 -0
  79. package/src/pyth/PriceServiceConnection.ts +69 -8
  80. package/src/queries/priceFeedQueries.ts +74 -24
  81. package/src/transactions/marginAdmin.ts +2 -4
  82. package/src/transactions/marginLiquidations.ts +20 -6
  83. package/src/transactions/marginManager.ts +43 -33
  84. package/src/transactions/marginTPSL.ts +19 -9
  85. package/src/transactions/poolProxy.ts +34 -30
  86. package/src/types/index.ts +16 -0
  87. package/src/utils/config.ts +69 -9
  88. package/src/utils/constants.ts +88 -25
@@ -1,5 +1,5 @@
1
1
  import { DeepBookConfig } from "../utils/config.mjs";
2
- import * as _mysten_sui_transactions78 from "@mysten/sui/transactions";
2
+ import * as _mysten_sui_transactions82 from "@mysten/sui/transactions";
3
3
  import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
4
4
 
5
5
  //#region src/transactions/marginPool.d.ts
@@ -16,7 +16,7 @@ declare class MarginPoolContract {
16
16
  * @description Mint a supplier cap for margin pool
17
17
  * @returns A function that takes a Transaction object
18
18
  */
19
- mintSupplierCap: () => (tx: Transaction) => _mysten_sui_transactions78.TransactionResult;
19
+ mintSupplierCap: () => (tx: Transaction) => _mysten_sui_transactions82.TransactionResult;
20
20
  /**
21
21
  * @description Supply to a margin pool
22
22
  * @param {string} coinKey The key to identify the pool
@@ -33,7 +33,7 @@ declare class MarginPoolContract {
33
33
  * @param {number} [amountToWithdraw] The amount to withdraw. If omitted, withdraws all.
34
34
  * @returns A function that takes a Transaction object
35
35
  */
36
- withdrawFromMarginPool: (coinKey: string, supplierCap: TransactionObjectArgument, amountToWithdraw?: number) => (tx: Transaction) => _mysten_sui_transactions78.TransactionResult;
36
+ withdrawFromMarginPool: (coinKey: string, supplierCap: TransactionObjectArgument, amountToWithdraw?: number) => (tx: Transaction) => _mysten_sui_transactions82.TransactionResult;
37
37
  /**
38
38
  * @description Mint a referral for a margin pool
39
39
  * @param {string} coinKey The key to identify the pool
@@ -46,94 +46,94 @@ declare class MarginPoolContract {
46
46
  * @param {string} referralId The ID of the referral
47
47
  * @returns A function that takes a Transaction object
48
48
  */
49
- withdrawReferralFees: (coinKey: string, referralId: string) => (tx: Transaction) => _mysten_sui_transactions78.TransactionResult;
49
+ withdrawReferralFees: (coinKey: string, referralId: string) => (tx: Transaction) => _mysten_sui_transactions82.TransactionResult;
50
50
  /**
51
51
  * @description Get the margin pool ID
52
52
  * @param {string} coinKey The key to identify the pool
53
53
  * @returns A function that takes a Transaction object
54
54
  */
55
- getId: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions78.TransactionResult;
55
+ getId: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions82.TransactionResult;
56
56
  /**
57
57
  * @description Check if a deepbook pool is allowed for borrowing
58
58
  * @param {string} coinKey The key to identify the margin pool
59
59
  * @param {string} deepbookPoolId The ID of the deepbook pool
60
60
  * @returns A function that takes a Transaction object
61
61
  */
62
- deepbookPoolAllowed: (coinKey: string, deepbookPoolId: string) => (tx: Transaction) => _mysten_sui_transactions78.TransactionResult;
62
+ deepbookPoolAllowed: (coinKey: string, deepbookPoolId: string) => (tx: Transaction) => _mysten_sui_transactions82.TransactionResult;
63
63
  /**
64
64
  * @description Get the total supply amount
65
65
  * @param {string} coinKey The key to identify the pool
66
66
  * @returns A function that takes a Transaction object
67
67
  */
68
- totalSupply: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions78.TransactionResult;
68
+ totalSupply: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions82.TransactionResult;
69
69
  /**
70
70
  * @description Get the total supply shares
71
71
  * @param {string} coinKey The key to identify the pool
72
72
  * @returns A function that takes a Transaction object
73
73
  */
74
- supplyShares: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions78.TransactionResult;
74
+ supplyShares: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions82.TransactionResult;
75
75
  /**
76
76
  * @description Get the total borrow amount
77
77
  * @param {string} coinKey The key to identify the pool
78
78
  * @returns A function that takes a Transaction object
79
79
  */
80
- totalBorrow: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions78.TransactionResult;
80
+ totalBorrow: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions82.TransactionResult;
81
81
  /**
82
82
  * @description Get the total borrow shares
83
83
  * @param {string} coinKey The key to identify the pool
84
84
  * @returns A function that takes a Transaction object
85
85
  */
86
- borrowShares: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions78.TransactionResult;
86
+ borrowShares: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions82.TransactionResult;
87
87
  /**
88
88
  * @description Get the last update timestamp
89
89
  * @param {string} coinKey The key to identify the pool
90
90
  * @returns A function that takes a Transaction object
91
91
  */
92
- lastUpdateTimestamp: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions78.TransactionResult;
92
+ lastUpdateTimestamp: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions82.TransactionResult;
93
93
  /**
94
94
  * @description Get the supply cap
95
95
  * @param {string} coinKey The key to identify the pool
96
96
  * @returns A function that takes a Transaction object
97
97
  */
98
- supplyCap: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions78.TransactionResult;
98
+ supplyCap: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions82.TransactionResult;
99
99
  /**
100
100
  * @description Get the max utilization rate
101
101
  * @param {string} coinKey The key to identify the pool
102
102
  * @returns A function that takes a Transaction object
103
103
  */
104
- maxUtilizationRate: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions78.TransactionResult;
104
+ maxUtilizationRate: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions82.TransactionResult;
105
105
  /**
106
106
  * @description Get the protocol spread
107
107
  * @param {string} coinKey The key to identify the pool
108
108
  * @returns A function that takes a Transaction object
109
109
  */
110
- protocolSpread: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions78.TransactionResult;
110
+ protocolSpread: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions82.TransactionResult;
111
111
  /**
112
112
  * @description Get the minimum borrow amount
113
113
  * @param {string} coinKey The key to identify the pool
114
114
  * @returns A function that takes a Transaction object
115
115
  */
116
- minBorrow: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions78.TransactionResult;
116
+ minBorrow: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions82.TransactionResult;
117
117
  /**
118
118
  * @description Get the current interest rate
119
119
  * @param {string} coinKey The key to identify the pool
120
120
  * @returns A function that takes a Transaction object
121
121
  */
122
- interestRate: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions78.TransactionResult;
122
+ interestRate: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions82.TransactionResult;
123
123
  /**
124
124
  * @description Get user supply shares for a supplier cap
125
125
  * @param {string} coinKey The key to identify the pool
126
126
  * @param {string} supplierCapId The ID of the supplier cap
127
127
  * @returns A function that takes a Transaction object
128
128
  */
129
- userSupplyShares: (coinKey: string, supplierCapId: string) => (tx: Transaction) => _mysten_sui_transactions78.TransactionResult;
129
+ userSupplyShares: (coinKey: string, supplierCapId: string) => (tx: Transaction) => _mysten_sui_transactions82.TransactionResult;
130
130
  /**
131
131
  * @description Get user supply amount for a supplier cap
132
132
  * @param {string} coinKey The key to identify the pool
133
133
  * @param {string} supplierCapId The ID of the supplier cap
134
134
  * @returns A function that takes a Transaction object
135
135
  */
136
- userSupplyAmount: (coinKey: string, supplierCapId: string) => (tx: Transaction) => _mysten_sui_transactions78.TransactionResult;
136
+ userSupplyAmount: (coinKey: string, supplierCapId: string) => (tx: Transaction) => _mysten_sui_transactions82.TransactionResult;
137
137
  }
138
138
  //#endregion
139
139
  export { MarginPoolContract };
@@ -1,5 +1,5 @@
1
1
  import { DeepBookConfig } from "../utils/config.mjs";
2
- import * as _mysten_sui_transactions128 from "@mysten/sui/transactions";
2
+ import * as _mysten_sui_transactions106 from "@mysten/sui/transactions";
3
3
  import { Transaction } from "@mysten/sui/transactions";
4
4
 
5
5
  //#region src/transactions/marginRegistry.d.ts
@@ -17,90 +17,90 @@ declare class MarginRegistryContract {
17
17
  * @param {string} poolKey The key to identify the pool
18
18
  * @returns A function that takes a Transaction object
19
19
  */
20
- poolEnabled: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions128.TransactionResult;
20
+ poolEnabled: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
21
21
  /**
22
22
  * @description Get the margin pool ID for a given asset
23
23
  * @param {string} coinKey The key to identify the coin
24
24
  * @returns A function that takes a Transaction object
25
25
  */
26
- getMarginPoolId: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions128.TransactionResult;
26
+ getMarginPoolId: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
27
27
  /**
28
28
  * @description Get the margin pool IDs (base and quote) for a deepbook pool
29
29
  * @param {string} poolKey The key to identify the pool
30
30
  * @returns A function that takes a Transaction object
31
31
  */
32
- getDeepbookPoolMarginPoolIds: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions128.TransactionResult;
32
+ getDeepbookPoolMarginPoolIds: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
33
33
  /**
34
34
  * @description Get the margin manager IDs for a given owner
35
35
  * @param {string} owner The owner address
36
36
  * @returns A function that takes a Transaction object
37
37
  */
38
- getMarginManagerIds: (owner: string) => (tx: Transaction) => _mysten_sui_transactions128.TransactionResult;
38
+ getMarginManagerIds: (owner: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
39
39
  /**
40
40
  * @description Get the base margin pool ID for a deepbook pool
41
41
  * @param {string} poolKey The key to identify the pool
42
42
  * @returns A function that takes a Transaction object
43
43
  */
44
- baseMarginPoolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions128.TransactionResult;
44
+ baseMarginPoolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
45
45
  /**
46
46
  * @description Get the quote margin pool ID for a deepbook pool
47
47
  * @param {string} poolKey The key to identify the pool
48
48
  * @returns A function that takes a Transaction object
49
49
  */
50
- quoteMarginPoolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions128.TransactionResult;
50
+ quoteMarginPoolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
51
51
  /**
52
52
  * @description Get the minimum withdraw risk ratio for a deepbook pool
53
53
  * @param {string} poolKey The key to identify the pool
54
54
  * @returns A function that takes a Transaction object
55
55
  */
56
- minWithdrawRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions128.TransactionResult;
56
+ minWithdrawRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
57
57
  /**
58
58
  * @description Get the minimum borrow risk ratio for a deepbook pool
59
59
  * @param {string} poolKey The key to identify the pool
60
60
  * @returns A function that takes a Transaction object
61
61
  */
62
- minBorrowRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions128.TransactionResult;
62
+ minBorrowRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
63
63
  /**
64
64
  * @description Get the minimum risk ratio required to open a new position on
65
65
  * a deepbook pool. Distinct from `minBorrowRiskRatio`, which gates borrowing.
66
66
  * @param {string} poolKey The key to identify the pool
67
67
  * @returns A function that takes a Transaction object
68
68
  */
69
- minOpenRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions128.TransactionResult;
69
+ minOpenRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
70
70
  /**
71
71
  * @description Get the liquidation risk ratio for a deepbook pool
72
72
  * @param {string} poolKey The key to identify the pool
73
73
  * @returns A function that takes a Transaction object
74
74
  */
75
- liquidationRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions128.TransactionResult;
75
+ liquidationRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
76
76
  /**
77
77
  * @description Get the target liquidation risk ratio for a deepbook pool
78
78
  * @param {string} poolKey The key to identify the pool
79
79
  * @returns A function that takes a Transaction object
80
80
  */
81
- targetLiquidationRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions128.TransactionResult;
81
+ targetLiquidationRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
82
82
  /**
83
83
  * @description Get the user liquidation reward for a deepbook pool
84
84
  * @param {string} poolKey The key to identify the pool
85
85
  * @returns A function that takes a Transaction object
86
86
  */
87
- userLiquidationReward: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions128.TransactionResult;
87
+ userLiquidationReward: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
88
88
  /**
89
89
  * @description Get the pool liquidation reward for a deepbook pool
90
90
  * @param {string} poolKey The key to identify the pool
91
91
  * @returns A function that takes a Transaction object
92
92
  */
93
- poolLiquidationReward: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions128.TransactionResult;
93
+ poolLiquidationReward: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
94
94
  /**
95
95
  * @description Get all allowed maintainer cap IDs
96
96
  * @returns A function that takes a Transaction object
97
97
  */
98
- allowedMaintainers: () => (tx: Transaction) => _mysten_sui_transactions128.TransactionResult;
98
+ allowedMaintainers: () => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
99
99
  /**
100
100
  * @description Get all allowed pause cap IDs
101
101
  * @returns A function that takes a Transaction object
102
102
  */
103
- allowedPauseCaps: () => (tx: Transaction) => _mysten_sui_transactions128.TransactionResult;
103
+ allowedPauseCaps: () => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
104
104
  }
105
105
  //#endregion
106
106
  export { MarginRegistryContract };
@@ -1,6 +1,6 @@
1
1
  import { AddConditionalOrderParams, PendingLimitOrderParams, PendingMarketOrderParams } from "../types/index.mjs";
2
2
  import { DeepBookConfig } from "../utils/config.mjs";
3
- import * as _mysten_sui_transactions38 from "@mysten/sui/transactions";
3
+ import * as _mysten_sui_transactions36 from "@mysten/sui/transactions";
4
4
  import { Transaction } from "@mysten/sui/transactions";
5
5
 
6
6
  //#region src/transactions/marginTPSL.d.ts
@@ -20,21 +20,21 @@ declare class MarginTPSLContract {
20
20
  * @param {number} triggerPrice The price at which to trigger the order
21
21
  * @returns A function that takes a Transaction object
22
22
  */
23
- newCondition: (poolKey: string, triggerBelowPrice: boolean, triggerPrice: number | bigint) => (tx: Transaction) => _mysten_sui_transactions38.TransactionResult;
23
+ newCondition: (poolKey: string, triggerBelowPrice: boolean, triggerPrice: number | bigint) => (tx: Transaction) => _mysten_sui_transactions36.TransactionResult;
24
24
  /**
25
25
  * @description Create a new pending limit order for use in conditional orders
26
26
  * @param {string} poolKey The key to identify the pool
27
27
  * @param {PendingLimitOrderParams} params Parameters for the pending limit order
28
28
  * @returns A function that takes a Transaction object
29
29
  */
30
- newPendingLimitOrder: (poolKey: string, params: PendingLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions38.TransactionResult;
30
+ newPendingLimitOrder: (poolKey: string, params: PendingLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions36.TransactionResult;
31
31
  /**
32
32
  * @description Create a new pending market order for use in conditional orders
33
33
  * @param {string} poolKey The key to identify the pool
34
34
  * @param {PendingMarketOrderParams} params Parameters for the pending market order
35
35
  * @returns A function that takes a Transaction object
36
36
  */
37
- newPendingMarketOrder: (poolKey: string, params: PendingMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions38.TransactionResult;
37
+ newPendingMarketOrder: (poolKey: string, params: PendingMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions36.TransactionResult;
38
38
  /**
39
39
  * @description Add a conditional order (take profit or stop loss)
40
40
  * @param {AddConditionalOrderParams} params Parameters for adding the conditional order
@@ -65,7 +65,7 @@ declare class MarginTPSLContract {
65
65
  * @param {number} maxOrdersToExecute Maximum number of orders to execute in this call
66
66
  * @returns A function that takes a Transaction object
67
67
  */
68
- executeConditionalOrders: (managerAddress: string, poolKey: string, maxOrdersToExecute: number) => (tx: Transaction) => _mysten_sui_transactions38.TransactionResult;
68
+ executeConditionalOrders: (managerAddress: string, poolKey: string, maxOrdersToExecute: number) => (tx: Transaction) => _mysten_sui_transactions36.TransactionResult;
69
69
  /**
70
70
  * @description Execute conditional orders, deleveraging on each market-type
71
71
  * fill. Permissionless, with the same trigger and cancellation handling as
@@ -83,14 +83,14 @@ declare class MarginTPSLContract {
83
83
  * @param {number} maxOrdersToExecute Maximum number of orders to execute in this call
84
84
  * @returns A function that takes a Transaction object
85
85
  */
86
- executeConditionalOrdersV3: (managerAddress: string, poolKey: string, maxOrdersToExecute: number) => (tx: Transaction) => _mysten_sui_transactions38.TransactionResult;
86
+ executeConditionalOrdersV3: (managerAddress: string, poolKey: string, maxOrdersToExecute: number) => (tx: Transaction) => _mysten_sui_transactions36.TransactionResult;
87
87
  /**
88
88
  * @description Get all conditional order IDs for a margin manager
89
89
  * @param {string} poolKey The key to identify the pool
90
90
  * @param {string} marginManagerId The ID of the margin manager
91
91
  * @returns A function that takes a Transaction object
92
92
  */
93
- conditionalOrderIds: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions38.TransactionResult;
93
+ conditionalOrderIds: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions36.TransactionResult;
94
94
  /**
95
95
  * @description Get a specific conditional order by ID
96
96
  * @param {string} poolKey The key to identify the pool
@@ -98,7 +98,7 @@ declare class MarginTPSLContract {
98
98
  * @param {string} conditionalOrderId The ID of the conditional order
99
99
  * @returns A function that takes a Transaction object
100
100
  */
101
- conditionalOrder: (poolKey: string, marginManagerId: string, conditionalOrderId: string) => (tx: Transaction) => _mysten_sui_transactions38.TransactionResult;
101
+ conditionalOrder: (poolKey: string, marginManagerId: string, conditionalOrderId: string) => (tx: Transaction) => _mysten_sui_transactions36.TransactionResult;
102
102
  /**
103
103
  * @description Get the lowest trigger price for trigger_above orders
104
104
  * Returns constants::max_u64() if there are no trigger_above orders
@@ -106,7 +106,7 @@ declare class MarginTPSLContract {
106
106
  * @param {string} marginManagerId The ID of the margin manager
107
107
  * @returns A function that takes a Transaction object
108
108
  */
109
- lowestTriggerAbovePrice: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions38.TransactionResult;
109
+ lowestTriggerAbovePrice: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions36.TransactionResult;
110
110
  /**
111
111
  * @description Get the highest trigger price for trigger_below orders
112
112
  * Returns 0 if there are no trigger_below orders
@@ -114,7 +114,7 @@ declare class MarginTPSLContract {
114
114
  * @param {string} marginManagerId The ID of the margin manager
115
115
  * @returns A function that takes a Transaction object
116
116
  */
117
- highestTriggerBelowPrice: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions38.TransactionResult;
117
+ highestTriggerBelowPrice: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions36.TransactionResult;
118
118
  }
119
119
  //#endregion
120
120
  export { MarginTPSLContract };
@@ -1 +1 @@
1
- {"version":3,"file":"marginTPSL.d.mts","names":[],"sources":["../../src/transactions/marginTPSL.ts"],"mappings":";;;;;;;;;cAmBa,kBAAA;EAAA;;;;cAMA,MAAA,EAAQ,cAAA;EAwCO;;;;;;;EA3B3B,YAAA,GACE,OAAA,UAAiB,iBAAA,WAA4B,YAAA,uBAC7C,EAAA,EAAI,WAA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AAA,cAA6B,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAAf;;;;;;;EAoBzE,wBAAA,GAA4B,OAAA,UAAiB,eAAA,cAA6B,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;AAAA"}
@@ -2,7 +2,8 @@ import { convertPrice, convertQuantity } from "../utils/conversion.mjs";
2
2
  import { FLOAT_SCALAR, MAX_TIMESTAMP } from "../utils/config.mjs";
3
3
  import { OrderType, SelfMatchingOptions } from "../types/index.mjs";
4
4
  import { newCondition, newPendingLimitOrder, newPendingMarketOrder } from "../contracts/deepbook_margin/tpsl.mjs";
5
- import { addConditionalOrder, cancelAllConditionalOrders, cancelConditionalOrder, conditionalOrder, conditionalOrderIds, executeConditionalOrdersV2, executeConditionalOrdersV3, highestTriggerBelowPrice, lowestTriggerAbovePrice } from "../contracts/deepbook_margin/margin_manager.mjs";
5
+ import { cancelAllConditionalOrders, cancelConditionalOrder, conditionalOrder, conditionalOrderIds, highestTriggerBelowPrice, lowestTriggerAbovePrice } from "../contracts/deepbook_margin/margin_manager.mjs";
6
+ import { margin_manager_upgraded_exports } from "../contracts/deepbook_margin/margin_manager_upgraded.mjs";
6
7
 
7
8
  //#region src/transactions/marginTPSL.ts
8
9
  /**
@@ -69,13 +70,13 @@ var MarginTPSLContract = class {
69
70
  const quoteCoin = this.#config.getCoin(pool.quoteCoin);
70
71
  const condition = this.newCondition(manager.poolKey, triggerBelowPrice, triggerPrice)(tx);
71
72
  const pending = "price" in pendingOrder ? this.newPendingLimitOrder(manager.poolKey, pendingOrder)(tx) : this.newPendingMarketOrder(manager.poolKey, pendingOrder)(tx);
72
- tx.add(addConditionalOrder({
73
+ tx.add(this.#oracleCalls.addConditionalOrder({
73
74
  package: this.#config.MARGIN_PACKAGE_ID,
74
75
  arguments: {
75
76
  self: manager.address,
76
77
  pool: pool.address,
77
- basePriceInfoObject: baseCoin.priceInfoObjectId,
78
- quotePriceInfoObject: quoteCoin.priceInfoObjectId,
78
+ basePriceInfoObject: this.#config.getPriceInfoObjectId(pool.baseCoin),
79
+ quotePriceInfoObject: this.#config.getPriceInfoObjectId(pool.quoteCoin),
79
80
  registry: this.#config.MARGIN_REGISTRY_ID,
80
81
  conditionalOrderId: BigInt(conditionalOrderId),
81
82
  condition,
@@ -115,15 +116,15 @@ var MarginTPSLContract = class {
115
116
  const quoteCoin = this.#config.getCoin(pool.quoteCoin);
116
117
  const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
117
118
  const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
118
- return tx.add(executeConditionalOrdersV2({
119
+ return tx.add(this.#oracleCalls.executeConditionalOrdersV2({
119
120
  package: this.#config.MARGIN_PACKAGE_ID,
120
121
  arguments: {
121
122
  self: managerAddress,
122
123
  pool: pool.address,
123
124
  baseMarginPool: baseMarginPool.address,
124
125
  quoteMarginPool: quoteMarginPool.address,
125
- basePriceInfoObject: baseCoin.priceInfoObjectId,
126
- quotePriceInfoObject: quoteCoin.priceInfoObjectId,
126
+ basePriceInfoObject: this.#config.getPriceInfoObjectId(pool.baseCoin),
127
+ quotePriceInfoObject: this.#config.getPriceInfoObjectId(pool.quoteCoin),
127
128
  registry: this.#config.MARGIN_REGISTRY_ID,
128
129
  maxOrdersToExecute
129
130
  },
@@ -136,15 +137,15 @@ var MarginTPSLContract = class {
136
137
  const quoteCoin = this.#config.getCoin(pool.quoteCoin);
137
138
  const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
138
139
  const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
139
- return tx.add(executeConditionalOrdersV3({
140
+ return tx.add(this.#oracleCalls.executeConditionalOrdersV3({
140
141
  package: this.#config.MARGIN_PACKAGE_ID,
141
142
  arguments: {
142
143
  self: managerAddress,
143
144
  pool: pool.address,
144
145
  baseMarginPool: baseMarginPool.address,
145
146
  quoteMarginPool: quoteMarginPool.address,
146
- basePriceInfoObject: baseCoin.priceInfoObjectId,
147
- quotePriceInfoObject: quoteCoin.priceInfoObjectId,
147
+ basePriceInfoObject: this.#config.getPriceInfoObjectId(pool.baseCoin),
148
+ quotePriceInfoObject: this.#config.getPriceInfoObjectId(pool.quoteCoin),
148
149
  registry: this.#config.MARGIN_REGISTRY_ID,
149
150
  maxOrdersToExecute
150
151
  },
@@ -196,6 +197,14 @@ var MarginTPSLContract = class {
196
197
  };
197
198
  this.#config = config;
198
199
  }
200
+ /**
201
+ * Oracle-taking entrypoints live in the parallel `_upgraded` module, which takes Pyth's
202
+ * upgraded-Core `PriceInfoObject`. Entrypoints with no oracle argument stay on the base
203
+ * module, which is the only place they exist.
204
+ */
205
+ get #oracleCalls() {
206
+ return margin_manager_upgraded_exports;
207
+ }
199
208
  };
200
209
 
201
210
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"marginTPSL.mjs","names":["#config","tpslMoveCalls.newCondition","tpslMoveCalls.newPendingLimitOrder","tpslMoveCalls.newPendingMarketOrder","marginManagerMoveCalls.addConditionalOrder","marginManagerMoveCalls.cancelAllConditionalOrders","marginManagerMoveCalls.cancelConditionalOrder","marginManagerMoveCalls.executeConditionalOrdersV2","marginManagerMoveCalls.executeConditionalOrdersV3","marginManagerMoveCalls.conditionalOrderIds","marginManagerMoveCalls.conditionalOrder","marginManagerMoveCalls.lowestTriggerAbovePrice","marginManagerMoveCalls.highestTriggerBelowPrice"],"sources":["../../src/transactions/marginTPSL.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport type {\n\tPendingLimitOrderParams,\n\tPendingMarketOrderParams,\n\tAddConditionalOrderParams,\n} from '../types/index.js';\nimport { OrderType, SelfMatchingOptions } from '../types/index.js';\nimport { MAX_TIMESTAMP, FLOAT_SCALAR } from '../utils/config.js';\nimport { convertQuantity, convertPrice } from '../utils/conversion.js';\nimport * as marginManagerMoveCalls from '../contracts/deepbook_margin/margin_manager.js';\nimport * as tpslMoveCalls from '../contracts/deepbook_margin/tpsl.js';\n\n/**\n * MarginTPSLContract class for managing Take Profit / Stop Loss operations.\n */\nexport class MarginTPSLContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginTPSLContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t// === Helper Functions ===\n\n\t/**\n\t * @description Create a new condition for a conditional order\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {boolean} triggerBelowPrice Whether to trigger when price is below trigger price\n\t * @param {number} triggerPrice The price at which to trigger the order\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewCondition =\n\t\t(poolKey: string, triggerBelowPrice: boolean, triggerPrice: number | bigint) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst inputPrice = convertPrice(\n\t\t\t\ttriggerPrice,\n\t\t\t\tFLOAT_SCALAR,\n\t\t\t\tquoteCoin.scalar,\n\t\t\t\tbaseCoin.scalar,\n\t\t\t);\n\t\t\treturn tx.add(\n\t\t\t\ttpslMoveCalls.newCondition({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: { triggerBelowPrice, triggerPrice: inputPrice },\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Create a new pending limit order for use in conditional orders\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {PendingLimitOrderParams} params Parameters for the pending limit order\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPendingLimitOrder =\n\t\t(poolKey: string, params: PendingLimitOrderParams) => (tx: Transaction) => {\n\t\t\tconst {\n\t\t\t\tclientOrderId,\n\t\t\t\torderType = OrderType.NO_RESTRICTION,\n\t\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\t\tprice,\n\t\t\t\tquantity,\n\t\t\t\tisBid,\n\t\t\t\tpayWithDeep = true,\n\t\t\t\texpireTimestamp = MAX_TIMESTAMP,\n\t\t\t} = params;\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);\n\t\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\t\t\treturn tx.add(\n\t\t\t\ttpslMoveCalls.newPendingLimitOrder({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\t\torderType,\n\t\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\t\tprice: inputPrice,\n\t\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\t\tisBid,\n\t\t\t\t\t\tpayWithDeep,\n\t\t\t\t\t\texpireTimestamp,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Create a new pending market order for use in conditional orders\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {PendingMarketOrderParams} params Parameters for the pending market order\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPendingMarketOrder =\n\t\t(poolKey: string, params: PendingMarketOrderParams) => (tx: Transaction) => {\n\t\t\tconst {\n\t\t\t\tclientOrderId,\n\t\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\t\tquantity,\n\t\t\t\tisBid,\n\t\t\t\tpayWithDeep = true,\n\t\t\t} = params;\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\t\t\treturn tx.add(\n\t\t\t\ttpslMoveCalls.newPendingMarketOrder({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\t\tisBid,\n\t\t\t\t\t\tpayWithDeep,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t// === Public Functions ===\n\n\t/**\n\t * @description Add a conditional order (take profit or stop loss)\n\t * @param {AddConditionalOrderParams} params Parameters for adding the conditional order\n\t * @returns A function that takes a Transaction object\n\t */\n\taddConditionalOrder = (params: AddConditionalOrderParams) => (tx: Transaction) => {\n\t\tconst { marginManagerKey, conditionalOrderId, triggerBelowPrice, triggerPrice, pendingOrder } =\n\t\t\tparams;\n\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(manager.poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\t// Create condition\n\t\tconst condition = this.newCondition(manager.poolKey, triggerBelowPrice, triggerPrice)(tx);\n\n\t\t// Create pending order based on type\n\t\tconst isLimitOrder = 'price' in pendingOrder;\n\t\tconst pending = isLimitOrder\n\t\t\t? this.newPendingLimitOrder(manager.poolKey, pendingOrder as PendingLimitOrderParams)(tx)\n\t\t\t: this.newPendingMarketOrder(manager.poolKey, pendingOrder as PendingMarketOrderParams)(tx);\n\n\t\ttx.add(\n\t\t\tmarginManagerMoveCalls.addConditionalOrder({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: manager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tbasePriceInfoObject: baseCoin.priceInfoObjectId!,\n\t\t\t\t\tquotePriceInfoObject: quoteCoin.priceInfoObjectId!,\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tconditionalOrderId: BigInt(conditionalOrderId),\n\t\t\t\t\tcondition,\n\t\t\t\t\tpendingOrder: pending,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Cancel all conditional orders for a margin manager\n\t * @param {string} marginManagerKey The key to identify the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tcancelAllConditionalOrders = (marginManagerKey: string) => (tx: Transaction) => {\n\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(manager.poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginManagerMoveCalls.cancelAllConditionalOrders({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: manager.address },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Cancel a specific conditional order\n\t * @param {string} marginManagerKey The key to identify the margin manager\n\t * @param {string} conditionalOrderId The ID of the conditional order to cancel\n\t * @returns A function that takes a Transaction object\n\t */\n\tcancelConditionalOrder =\n\t\t(marginManagerKey: string, conditionalOrderId: string) => (tx: Transaction) => {\n\t\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\n\t\t\tconst pool = this.#config.getPool(manager.poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\ttx.add(\n\t\t\t\tmarginManagerMoveCalls.cancelConditionalOrder({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: { self: manager.address, conditionalOrderId: BigInt(conditionalOrderId) },\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Execute conditional orders that have been triggered.\n\t * Permissionless — anyone can call this. After the inner fill loop, the\n\t * manager's post-trade `risk_ratio` is checked against\n\t * `min_borrow_risk_ratio`; if any triggered fill breaches that floor, the\n\t * whole txn aborts (no partial-state landing).\n\t * @param {string} managerAddress The address of the margin manager\n\t * @param {string} poolKey The key to identify the pool (e.g., 'SUI_USDC')\n\t * @param {number} maxOrdersToExecute Maximum number of orders to execute in this call\n\t * @returns A function that takes a Transaction object\n\t */\n\texecuteConditionalOrders =\n\t\t(managerAddress: string, poolKey: string, maxOrdersToExecute: number) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\t\treturn tx.add(\n\t\t\t\tmarginManagerMoveCalls.executeConditionalOrdersV2({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: managerAddress,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\t\tbasePriceInfoObject: baseCoin.priceInfoObjectId!,\n\t\t\t\t\t\tquotePriceInfoObject: quoteCoin.priceInfoObjectId!,\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tmaxOrdersToExecute,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Execute conditional orders, deleveraging on each market-type\n\t * fill. Permissionless, with the same trigger and cancellation handling as\n\t * {@link executeConditionalOrders}, but the market proceeds are repaid into\n\t * the loan before the risk check, and the gate is the *net* post-repay\n\t * `risk_ratio` being at least the pre-fill ratio.\n\t *\n\t * This is what lets a stop-loss fire in the `liquidation..min_borrow` danger\n\t * band: a swap alone only lowers the oracle-valued ratio (so the v2\n\t * borrow-floor gate rejects it), while repaying actually improves it. If a\n\t * single triggered fill would worsen net solvency the whole txn aborts — no\n\t * partial-state landing.\n\t * @param {string} managerAddress The address of the margin manager\n\t * @param {string} poolKey The key to identify the pool (e.g., 'SUI_USDC')\n\t * @param {number} maxOrdersToExecute Maximum number of orders to execute in this call\n\t * @returns A function that takes a Transaction object\n\t */\n\texecuteConditionalOrdersV3 =\n\t\t(managerAddress: string, poolKey: string, maxOrdersToExecute: number) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\t\treturn tx.add(\n\t\t\t\tmarginManagerMoveCalls.executeConditionalOrdersV3({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: managerAddress,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\t\tbasePriceInfoObject: baseCoin.priceInfoObjectId!,\n\t\t\t\t\t\tquotePriceInfoObject: quoteCoin.priceInfoObjectId!,\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tmaxOrdersToExecute,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t// === Read-Only Functions ===\n\n\t/**\n\t * @description Get all conditional order IDs for a margin manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tconditionalOrderIds = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\treturn tx.add(\n\t\t\tmarginManagerMoveCalls.conditionalOrderIds({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: marginManagerId },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get a specific conditional order by ID\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @param {string} conditionalOrderId The ID of the conditional order\n\t * @returns A function that takes a Transaction object\n\t */\n\tconditionalOrder =\n\t\t(poolKey: string, marginManagerId: string, conditionalOrderId: string) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\treturn tx.add(\n\t\t\t\tmarginManagerMoveCalls.conditionalOrder({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: { self: marginManagerId, conditionalOrderId: BigInt(conditionalOrderId) },\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Get the lowest trigger price for trigger_above orders\n\t * Returns constants::max_u64() if there are no trigger_above orders\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tlowestTriggerAbovePrice = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\treturn tx.add(\n\t\t\tmarginManagerMoveCalls.lowestTriggerAbovePrice({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: marginManagerId },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the highest trigger price for trigger_below orders\n\t * Returns 0 if there are no trigger_below orders\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\thighestTriggerBelowPrice = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\treturn tx.add(\n\t\t\tmarginManagerMoveCalls.highestTriggerBelowPrice({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: marginManagerId },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n}\n"],"mappings":";;;;;;;;;;AAmBA,IAAa,qBAAb,MAAgC;CAC/B;;;;CAKA,YAAY,QAAwB;uBAclC,SAAiB,mBAA4B,kBAC7C,OAAoB;GACpB,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;GAC1C,MAAM,WAAW,MAAKA,OAAQ,QAAQ,KAAK,SAAS;GAEpD,MAAM,aAAa,aAClB,cACA,cAHiB,MAAKA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,QAAQ;GAC1C,MAAM,WAAW,MAAKA,OAAQ,QAAQ,KAAK,SAAS;GACpD,MAAM,YAAY,MAAKA,OAAQ,QAAQ,KAAK,UAAU;AACtD,UAAO,GAAG,IACTY,yBAAgD;IAC/C,SAAS,MAAKZ,OAAQ;IACtB,WAAW,EAAE,MAAM,iBAAiB;IACpC,eAAe,CAAC,SAAS,MAAM,UAAU,KAAK;IAC9C,CAAC,CACF;;AAvVD,QAAKA,SAAU"}
1
+ {"version":3,"file":"marginTPSL.mjs","names":["#config","tpslMoveCalls.newCondition","tpslMoveCalls.newPendingLimitOrder","tpslMoveCalls.newPendingMarketOrder","#oracleCalls","marginManagerMoveCalls.cancelAllConditionalOrders","marginManagerMoveCalls.cancelConditionalOrder","marginManagerMoveCalls.conditionalOrderIds","marginManagerMoveCalls.conditionalOrder","marginManagerMoveCalls.lowestTriggerAbovePrice","marginManagerMoveCalls.highestTriggerBelowPrice","marginManagerUpgradedMoveCalls"],"sources":["../../src/transactions/marginTPSL.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport type {\n\tPendingLimitOrderParams,\n\tPendingMarketOrderParams,\n\tAddConditionalOrderParams,\n} from '../types/index.js';\nimport { OrderType, SelfMatchingOptions } from '../types/index.js';\nimport { MAX_TIMESTAMP, FLOAT_SCALAR } from '../utils/config.js';\nimport { convertQuantity, convertPrice } from '../utils/conversion.js';\nimport * as marginManagerMoveCalls from '../contracts/deepbook_margin/margin_manager.js';\nimport * as marginManagerUpgradedMoveCalls from '../contracts/deepbook_margin/margin_manager_upgraded.js';\nimport * as tpslMoveCalls from '../contracts/deepbook_margin/tpsl.js';\n\n/**\n * MarginTPSLContract class for managing Take Profit / Stop Loss operations.\n */\nexport class MarginTPSLContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for MarginTPSLContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * Oracle-taking entrypoints live in the parallel `_upgraded` module, which takes Pyth's\n\t * upgraded-Core `PriceInfoObject`. Entrypoints with no oracle argument stay on the base\n\t * module, which is the only place they exist.\n\t */\n\tget #oracleCalls() {\n\t\treturn marginManagerUpgradedMoveCalls;\n\t}\n\n\t// === Helper Functions ===\n\n\t/**\n\t * @description Create a new condition for a conditional order\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {boolean} triggerBelowPrice Whether to trigger when price is below trigger price\n\t * @param {number} triggerPrice The price at which to trigger the order\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewCondition =\n\t\t(poolKey: string, triggerBelowPrice: boolean, triggerPrice: number | bigint) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst inputPrice = convertPrice(\n\t\t\t\ttriggerPrice,\n\t\t\t\tFLOAT_SCALAR,\n\t\t\t\tquoteCoin.scalar,\n\t\t\t\tbaseCoin.scalar,\n\t\t\t);\n\t\t\treturn tx.add(\n\t\t\t\ttpslMoveCalls.newCondition({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: { triggerBelowPrice, triggerPrice: inputPrice },\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Create a new pending limit order for use in conditional orders\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {PendingLimitOrderParams} params Parameters for the pending limit order\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPendingLimitOrder =\n\t\t(poolKey: string, params: PendingLimitOrderParams) => (tx: Transaction) => {\n\t\t\tconst {\n\t\t\t\tclientOrderId,\n\t\t\t\torderType = OrderType.NO_RESTRICTION,\n\t\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\t\tprice,\n\t\t\t\tquantity,\n\t\t\t\tisBid,\n\t\t\t\tpayWithDeep = true,\n\t\t\t\texpireTimestamp = MAX_TIMESTAMP,\n\t\t\t} = params;\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);\n\t\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\t\t\treturn tx.add(\n\t\t\t\ttpslMoveCalls.newPendingLimitOrder({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\t\torderType,\n\t\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\t\tprice: inputPrice,\n\t\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\t\tisBid,\n\t\t\t\t\t\tpayWithDeep,\n\t\t\t\t\t\texpireTimestamp,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Create a new pending market order for use in conditional orders\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {PendingMarketOrderParams} params Parameters for the pending market order\n\t * @returns A function that takes a Transaction object\n\t */\n\tnewPendingMarketOrder =\n\t\t(poolKey: string, params: PendingMarketOrderParams) => (tx: Transaction) => {\n\t\t\tconst {\n\t\t\t\tclientOrderId,\n\t\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\t\tquantity,\n\t\t\t\tisBid,\n\t\t\t\tpayWithDeep = true,\n\t\t\t} = params;\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\t\t\treturn tx.add(\n\t\t\t\ttpslMoveCalls.newPendingMarketOrder({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\t\tisBid,\n\t\t\t\t\t\tpayWithDeep,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t// === Public Functions ===\n\n\t/**\n\t * @description Add a conditional order (take profit or stop loss)\n\t * @param {AddConditionalOrderParams} params Parameters for adding the conditional order\n\t * @returns A function that takes a Transaction object\n\t */\n\taddConditionalOrder = (params: AddConditionalOrderParams) => (tx: Transaction) => {\n\t\tconst { marginManagerKey, conditionalOrderId, triggerBelowPrice, triggerPrice, pendingOrder } =\n\t\t\tparams;\n\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(manager.poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\t// Create condition\n\t\tconst condition = this.newCondition(manager.poolKey, triggerBelowPrice, triggerPrice)(tx);\n\n\t\t// Create pending order based on type\n\t\tconst isLimitOrder = 'price' in pendingOrder;\n\t\tconst pending = isLimitOrder\n\t\t\t? this.newPendingLimitOrder(manager.poolKey, pendingOrder as PendingLimitOrderParams)(tx)\n\t\t\t: this.newPendingMarketOrder(manager.poolKey, pendingOrder as PendingMarketOrderParams)(tx);\n\n\t\ttx.add(\n\t\t\tthis.#oracleCalls.addConditionalOrder({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: manager.address,\n\t\t\t\t\tpool: pool.address,\n\t\t\t\t\tbasePriceInfoObject: this.#config.getPriceInfoObjectId(pool.baseCoin),\n\t\t\t\t\tquotePriceInfoObject: this.#config.getPriceInfoObjectId(pool.quoteCoin),\n\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\tconditionalOrderId: BigInt(conditionalOrderId),\n\t\t\t\t\tcondition,\n\t\t\t\t\tpendingOrder: pending,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Cancel all conditional orders for a margin manager\n\t * @param {string} marginManagerKey The key to identify the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tcancelAllConditionalOrders = (marginManagerKey: string) => (tx: Transaction) => {\n\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(manager.poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tmarginManagerMoveCalls.cancelAllConditionalOrders({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: manager.address },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Cancel a specific conditional order\n\t * @param {string} marginManagerKey The key to identify the margin manager\n\t * @param {string} conditionalOrderId The ID of the conditional order to cancel\n\t * @returns A function that takes a Transaction object\n\t */\n\tcancelConditionalOrder =\n\t\t(marginManagerKey: string, conditionalOrderId: string) => (tx: Transaction) => {\n\t\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\n\t\t\tconst pool = this.#config.getPool(manager.poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\ttx.add(\n\t\t\t\tmarginManagerMoveCalls.cancelConditionalOrder({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: { self: manager.address, conditionalOrderId: BigInt(conditionalOrderId) },\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Execute conditional orders that have been triggered.\n\t * Permissionless — anyone can call this. After the inner fill loop, the\n\t * manager's post-trade `risk_ratio` is checked against\n\t * `min_borrow_risk_ratio`; if any triggered fill breaches that floor, the\n\t * whole txn aborts (no partial-state landing).\n\t * @param {string} managerAddress The address of the margin manager\n\t * @param {string} poolKey The key to identify the pool (e.g., 'SUI_USDC')\n\t * @param {number} maxOrdersToExecute Maximum number of orders to execute in this call\n\t * @returns A function that takes a Transaction object\n\t */\n\texecuteConditionalOrders =\n\t\t(managerAddress: string, poolKey: string, maxOrdersToExecute: number) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\t\treturn tx.add(\n\t\t\t\tthis.#oracleCalls.executeConditionalOrdersV2({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: managerAddress,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\t\tbasePriceInfoObject: this.#config.getPriceInfoObjectId(pool.baseCoin),\n\t\t\t\t\t\tquotePriceInfoObject: this.#config.getPriceInfoObjectId(pool.quoteCoin),\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tmaxOrdersToExecute,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Execute conditional orders, deleveraging on each market-type\n\t * fill. Permissionless, with the same trigger and cancellation handling as\n\t * {@link executeConditionalOrders}, but the market proceeds are repaid into\n\t * the loan before the risk check, and the gate is the *net* post-repay\n\t * `risk_ratio` being at least the pre-fill ratio.\n\t *\n\t * This is what lets a stop-loss fire in the `liquidation..min_borrow` danger\n\t * band: a swap alone only lowers the oracle-valued ratio (so the v2\n\t * borrow-floor gate rejects it), while repaying actually improves it. If a\n\t * single triggered fill would worsen net solvency the whole txn aborts — no\n\t * partial-state landing.\n\t * @param {string} managerAddress The address of the margin manager\n\t * @param {string} poolKey The key to identify the pool (e.g., 'SUI_USDC')\n\t * @param {number} maxOrdersToExecute Maximum number of orders to execute in this call\n\t * @returns A function that takes a Transaction object\n\t */\n\texecuteConditionalOrdersV3 =\n\t\t(managerAddress: string, poolKey: string, maxOrdersToExecute: number) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst baseMarginPool = this.#config.getMarginPool(pool.baseCoin);\n\t\t\tconst quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);\n\t\t\treturn tx.add(\n\t\t\t\tthis.#oracleCalls.executeConditionalOrdersV3({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: managerAddress,\n\t\t\t\t\t\tpool: pool.address,\n\t\t\t\t\t\tbaseMarginPool: baseMarginPool.address,\n\t\t\t\t\t\tquoteMarginPool: quoteMarginPool.address,\n\t\t\t\t\t\tbasePriceInfoObject: this.#config.getPriceInfoObjectId(pool.baseCoin),\n\t\t\t\t\t\tquotePriceInfoObject: this.#config.getPriceInfoObjectId(pool.quoteCoin),\n\t\t\t\t\t\tregistry: this.#config.MARGIN_REGISTRY_ID,\n\t\t\t\t\t\tmaxOrdersToExecute,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t// === Read-Only Functions ===\n\n\t/**\n\t * @description Get all conditional order IDs for a margin manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tconditionalOrderIds = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\treturn tx.add(\n\t\t\tmarginManagerMoveCalls.conditionalOrderIds({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: marginManagerId },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get a specific conditional order by ID\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @param {string} conditionalOrderId The ID of the conditional order\n\t * @returns A function that takes a Transaction object\n\t */\n\tconditionalOrder =\n\t\t(poolKey: string, marginManagerId: string, conditionalOrderId: string) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\treturn tx.add(\n\t\t\t\tmarginManagerMoveCalls.conditionalOrder({\n\t\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\t\targuments: { self: marginManagerId, conditionalOrderId: BigInt(conditionalOrderId) },\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Get the lowest trigger price for trigger_above orders\n\t * Returns constants::max_u64() if there are no trigger_above orders\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tlowestTriggerAbovePrice = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\treturn tx.add(\n\t\t\tmarginManagerMoveCalls.lowestTriggerAbovePrice({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: marginManagerId },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the highest trigger price for trigger_below orders\n\t * Returns 0 if there are no trigger_below orders\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} marginManagerId The ID of the margin manager\n\t * @returns A function that takes a Transaction object\n\t */\n\thighestTriggerBelowPrice = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\treturn tx.add(\n\t\t\tmarginManagerMoveCalls.highestTriggerBelowPrice({\n\t\t\t\tpackage: this.#config.MARGIN_PACKAGE_ID,\n\t\t\t\targuments: { self: marginManagerId },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n}\n"],"mappings":";;;;;;;;;;;AAoBA,IAAa,qBAAb,MAAgC;CAC/B;;;;CAKA,YAAY,QAAwB;uBAuBlC,SAAiB,mBAA4B,kBAC7C,OAAoB;GACpB,MAAM,OAAO,MAAKA,OAAQ,QAAQ,QAAQ;GAC1C,MAAM,WAAW,MAAKA,OAAQ,Q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