@mysten/deepbook-v3 1.5.8 → 1.6.2
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/CHANGELOG.md +73 -0
- package/dist/client.d.mts +5 -0
- package/dist/client.d.mts.map +1 -1
- package/dist/client.mjs +7 -0
- package/dist/client.mjs.map +1 -1
- package/dist/contracts/deepbook/account.d.mts +18 -18
- package/dist/contracts/deepbook/account.d.mts.map +1 -1
- package/dist/contracts/deepbook/balance_manager.mjs +413 -0
- package/dist/contracts/deepbook/balance_manager.mjs.map +1 -0
- package/dist/contracts/deepbook/big_vector.mjs +43 -0
- package/dist/contracts/deepbook/big_vector.mjs.map +1 -0
- package/dist/contracts/deepbook/book.mjs +29 -0
- package/dist/contracts/deepbook/book.mjs.map +1 -0
- package/dist/contracts/deepbook/deep_price.d.mts +3 -3
- package/dist/contracts/deepbook/deep_price.d.mts.map +1 -1
- package/dist/contracts/deepbook/deep_price.mjs +1 -1
- package/dist/contracts/deepbook/deps/std/type_name.mjs +17 -0
- package/dist/contracts/deepbook/deps/std/type_name.mjs.map +1 -0
- package/dist/contracts/deepbook/deps/sui/bag.mjs +43 -0
- package/dist/contracts/deepbook/deps/sui/bag.mjs.map +1 -0
- package/dist/contracts/deepbook/deps/sui/balance.mjs +21 -0
- package/dist/contracts/deepbook/deps/sui/balance.mjs.map +1 -0
- package/dist/contracts/deepbook/deps/sui/table.mjs +38 -0
- package/dist/contracts/deepbook/deps/sui/table.mjs.map +1 -0
- package/dist/contracts/deepbook/deps/sui/vec_map.mjs +37 -0
- package/dist/contracts/deepbook/deps/sui/vec_map.mjs.map +1 -0
- package/dist/contracts/deepbook/deps/sui/versioned.mjs +19 -0
- package/dist/contracts/deepbook/deps/sui/versioned.mjs.map +1 -0
- package/dist/contracts/deepbook/governance.mjs +49 -0
- package/dist/contracts/deepbook/governance.mjs.map +1 -0
- package/dist/contracts/deepbook/history.mjs +56 -0
- package/dist/contracts/deepbook/history.mjs.map +1 -0
- package/dist/contracts/deepbook/order.d.mts +12 -12
- package/dist/contracts/deepbook/pool.mjs +1739 -0
- package/dist/contracts/deepbook/pool.mjs.map +1 -0
- package/dist/contracts/deepbook/registry.mjs +295 -0
- package/dist/contracts/deepbook/registry.mjs.map +1 -0
- package/dist/contracts/deepbook/state.mjs +89 -0
- package/dist/contracts/deepbook/state.mjs.map +1 -0
- package/dist/contracts/deepbook/trade_params.mjs +21 -0
- package/dist/contracts/deepbook/trade_params.mjs.map +1 -0
- package/dist/contracts/deepbook/vault.mjs +42 -0
- package/dist/contracts/deepbook/vault.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/deepbook/balance_manager.mjs +53 -0
- package/dist/contracts/deepbook_margin/deps/deepbook/balance_manager.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/std/type_name.mjs +17 -0
- package/dist/contracts/deepbook_margin/deps/std/type_name.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/sui/bag.mjs +43 -0
- package/dist/contracts/deepbook_margin/deps/sui/bag.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/sui/balance.mjs +21 -0
- package/dist/contracts/deepbook_margin/deps/sui/balance.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/sui/table.mjs +38 -0
- package/dist/contracts/deepbook_margin/deps/sui/table.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/sui/vec_map.mjs +37 -0
- package/dist/contracts/deepbook_margin/deps/sui/vec_map.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/sui/vec_set.mjs +26 -0
- package/dist/contracts/deepbook_margin/deps/sui/vec_set.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/deps/sui/versioned.mjs +19 -0
- package/dist/contracts/deepbook_margin/deps/sui/versioned.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/margin_manager.mjs +989 -0
- package/dist/contracts/deepbook_margin/margin_manager.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/margin_pool.mjs +550 -0
- package/dist/contracts/deepbook_margin/margin_pool.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/margin_registry.mjs +786 -0
- package/dist/contracts/deepbook_margin/margin_registry.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/margin_state.mjs +30 -0
- package/dist/contracts/deepbook_margin/margin_state.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/oracle.mjs +82 -0
- package/dist/contracts/deepbook_margin/oracle.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/pool_proxy.mjs +644 -0
- package/dist/contracts/deepbook_margin/pool_proxy.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/position_manager.mjs +32 -0
- package/dist/contracts/deepbook_margin/position_manager.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/protocol_config.mjs +122 -0
- package/dist/contracts/deepbook_margin/protocol_config.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/protocol_fees.mjs +58 -0
- package/dist/contracts/deepbook_margin/protocol_fees.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/rate_limiter.mjs +26 -0
- package/dist/contracts/deepbook_margin/rate_limiter.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/tpsl.mjs +171 -0
- package/dist/contracts/deepbook_margin/tpsl.mjs.map +1 -0
- package/dist/contracts/margin_liquidation/deps/sui/bag.mjs +43 -0
- package/dist/contracts/margin_liquidation/deps/sui/bag.mjs.map +1 -0
- package/dist/contracts/margin_liquidation/liquidation_vault.mjs +179 -0
- package/dist/contracts/margin_liquidation/liquidation_vault.mjs.map +1 -0
- package/dist/contracts/utils/index.d.mts +1 -1
- package/dist/contracts/utils/index.mjs +92 -3
- package/dist/contracts/utils/index.mjs.map +1 -1
- package/dist/queries/registryQueries.mjs +13 -0
- package/dist/queries/registryQueries.mjs.map +1 -1
- package/dist/transactions/balanceManager.d.mts.map +1 -1
- package/dist/transactions/balanceManager.mjs +119 -100
- package/dist/transactions/balanceManager.mjs.map +1 -1
- package/dist/transactions/deepbook.d.mts.map +1 -1
- package/dist/transactions/deepbook.mjs +464 -439
- package/dist/transactions/deepbook.mjs.map +1 -1
- package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
- package/dist/transactions/deepbookAdmin.mjs +151 -135
- package/dist/transactions/deepbookAdmin.mjs.map +1 -1
- package/dist/transactions/flashLoans.d.mts.map +1 -1
- package/dist/transactions/flashLoans.mjs +29 -22
- package/dist/transactions/flashLoans.mjs.map +1 -1
- package/dist/transactions/governance.d.mts.map +1 -1
- package/dist/transactions/governance.mjs +34 -33
- package/dist/transactions/governance.mjs.map +1 -1
- package/dist/transactions/marginAdmin.d.mts +17 -7
- package/dist/transactions/marginAdmin.d.mts.map +1 -1
- package/dist/transactions/marginAdmin.mjs +186 -169
- package/dist/transactions/marginAdmin.mjs.map +1 -1
- package/dist/transactions/marginLiquidations.d.mts +3 -3
- package/dist/transactions/marginLiquidations.d.mts.map +1 -1
- package/dist/transactions/marginLiquidations.mjs +53 -54
- package/dist/transactions/marginLiquidations.mjs.map +1 -1
- package/dist/transactions/marginMaintainer.d.mts +5 -5
- package/dist/transactions/marginMaintainer.d.mts.map +1 -1
- package/dist/transactions/marginMaintainer.mjs +83 -83
- package/dist/transactions/marginMaintainer.mjs.map +1 -1
- package/dist/transactions/marginManager.d.mts +32 -32
- package/dist/transactions/marginManager.d.mts.map +1 -1
- package/dist/transactions/marginManager.mjs +330 -317
- package/dist/transactions/marginManager.mjs.map +1 -1
- package/dist/transactions/marginPool.d.mts +18 -18
- package/dist/transactions/marginPool.d.mts.map +1 -1
- package/dist/transactions/marginPool.mjs +93 -89
- package/dist/transactions/marginPool.mjs.map +1 -1
- package/dist/transactions/marginRegistry.d.mts +22 -15
- package/dist/transactions/marginRegistry.d.mts.map +1 -1
- package/dist/transactions/marginRegistry.mjs +101 -68
- package/dist/transactions/marginRegistry.mjs.map +1 -1
- package/dist/transactions/marginTPSL.d.mts +27 -9
- package/dist/transactions/marginTPSL.d.mts.map +1 -1
- package/dist/transactions/marginTPSL.mjs +108 -82
- package/dist/transactions/marginTPSL.mjs.map +1 -1
- package/dist/transactions/poolProxy.d.mts +37 -5
- package/dist/transactions/poolProxy.d.mts.map +1 -1
- package/dist/transactions/poolProxy.mjs +269 -189
- package/dist/transactions/poolProxy.mjs.map +1 -1
- package/dist/utils/constants.mjs +4 -4
- package/dist/utils/constants.mjs.map +1 -1
- package/package.json +3 -3
- package/src/client.ts +8 -0
- package/src/contracts/deepbook/balance_manager.ts +46 -5
- package/src/contracts/deepbook/constants.ts +13 -0
- package/src/contracts/deepbook/pool.ts +133 -0
- package/src/contracts/deepbook/registry.ts +136 -1
- package/src/contracts/deepbook_margin/deps/deepbook/balance_manager.ts +49 -0
- package/src/contracts/deepbook_margin/deps/std/type_name.ts +24 -0
- package/src/contracts/deepbook_margin/deps/sui/bag.ts +41 -0
- package/src/contracts/deepbook_margin/deps/sui/balance.ts +19 -0
- package/src/contracts/deepbook_margin/deps/sui/table.ts +36 -0
- package/src/contracts/deepbook_margin/deps/sui/vec_map.ts +33 -0
- package/src/contracts/deepbook_margin/deps/sui/vec_set.ts +22 -0
- package/src/contracts/deepbook_margin/deps/sui/versioned.ts +13 -0
- package/src/contracts/deepbook_margin/margin_constants.ts +329 -0
- package/src/contracts/deepbook_margin/margin_manager.ts +1772 -0
- package/src/contracts/deepbook_margin/margin_pool.ts +1129 -0
- package/src/contracts/deepbook_margin/margin_registry.ts +1207 -0
- package/src/contracts/deepbook_margin/margin_state.ts +26 -0
- package/src/contracts/deepbook_margin/oracle.ts +99 -0
- package/src/contracts/deepbook_margin/pool_proxy.ts +1298 -0
- package/src/contracts/deepbook_margin/position_manager.ts +28 -0
- package/src/contracts/deepbook_margin/protocol_config.ts +163 -0
- package/src/contracts/deepbook_margin/protocol_fees.ts +153 -0
- package/src/contracts/deepbook_margin/rate_limiter.ts +80 -0
- package/src/contracts/deepbook_margin/tpsl.ts +559 -0
- package/src/contracts/margin_liquidation/deps/sui/bag.ts +41 -0
- package/src/contracts/margin_liquidation/liquidation_vault.ts +401 -0
- package/src/queries/registryQueries.ts +15 -0
- package/src/transactions/balanceManager.ts +140 -90
- package/src/transactions/deepbook.ts +586 -494
- package/src/transactions/deepbookAdmin.ts +154 -146
- package/src/transactions/flashLoans.ts +29 -20
- package/src/transactions/governance.ts +50 -37
- package/src/transactions/marginAdmin.ts +247 -188
- package/src/transactions/marginLiquidations.ts +70 -55
- package/src/transactions/marginMaintainer.ts +106 -88
- package/src/transactions/marginManager.ts +414 -348
- package/src/transactions/marginPool.ts +140 -103
- package/src/transactions/marginRegistry.ts +103 -70
- package/src/transactions/marginTPSL.ts +151 -87
- package/src/transactions/poolProxy.ts +384 -205
- package/src/utils/constants.ts +4 -4
|
@@ -0,0 +1,1129 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
5
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
6
|
+
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
7
|
+
import * as balance from './deps/sui/balance.js';
|
|
8
|
+
import * as margin_state from './margin_state.js';
|
|
9
|
+
import * as protocol_config from './protocol_config.js';
|
|
10
|
+
import * as protocol_fees from './protocol_fees.js';
|
|
11
|
+
import * as position_manager from './position_manager.js';
|
|
12
|
+
import * as vec_set from './deps/sui/vec_set.js';
|
|
13
|
+
import * as rate_limiter from './rate_limiter.js';
|
|
14
|
+
import * as vec_map from './deps/sui/vec_map.js';
|
|
15
|
+
import * as type_name from './deps/std/type_name.js';
|
|
16
|
+
const $moduleName = '@deepbook/margin::margin_pool';
|
|
17
|
+
export const MarginPool = new MoveStruct({
|
|
18
|
+
name: `${$moduleName}::MarginPool<phantom Asset>`,
|
|
19
|
+
fields: {
|
|
20
|
+
id: bcs.Address,
|
|
21
|
+
vault: balance.Balance,
|
|
22
|
+
state: margin_state.State,
|
|
23
|
+
config: protocol_config.ProtocolConfig,
|
|
24
|
+
protocol_fees: protocol_fees.ProtocolFees,
|
|
25
|
+
positions: position_manager.PositionManager,
|
|
26
|
+
allowed_deepbook_pools: vec_set.VecSet(bcs.Address),
|
|
27
|
+
rate_limiter: rate_limiter.RateLimiter,
|
|
28
|
+
extra_fields: vec_map.VecMap(bcs.string(), bcs.u64()),
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
export const SupplierCap = new MoveStruct({
|
|
32
|
+
name: `${$moduleName}::SupplierCap`,
|
|
33
|
+
fields: {
|
|
34
|
+
id: bcs.Address,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
export const MarginPoolCreated = new MoveStruct({
|
|
38
|
+
name: `${$moduleName}::MarginPoolCreated`,
|
|
39
|
+
fields: {
|
|
40
|
+
margin_pool_id: bcs.Address,
|
|
41
|
+
maintainer_cap_id: bcs.Address,
|
|
42
|
+
asset_type: type_name.TypeName,
|
|
43
|
+
config: protocol_config.ProtocolConfig,
|
|
44
|
+
timestamp: bcs.u64(),
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
export const MaintainerFeesWithdrawn = new MoveStruct({
|
|
48
|
+
name: `${$moduleName}::MaintainerFeesWithdrawn`,
|
|
49
|
+
fields: {
|
|
50
|
+
margin_pool_id: bcs.Address,
|
|
51
|
+
margin_pool_cap_id: bcs.Address,
|
|
52
|
+
maintainer_fees: bcs.u64(),
|
|
53
|
+
timestamp: bcs.u64(),
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
export const ProtocolFeesWithdrawn = new MoveStruct({
|
|
57
|
+
name: `${$moduleName}::ProtocolFeesWithdrawn`,
|
|
58
|
+
fields: {
|
|
59
|
+
margin_pool_id: bcs.Address,
|
|
60
|
+
protocol_fees: bcs.u64(),
|
|
61
|
+
timestamp: bcs.u64(),
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
export const DeepbookPoolUpdated = new MoveStruct({
|
|
65
|
+
name: `${$moduleName}::DeepbookPoolUpdated`,
|
|
66
|
+
fields: {
|
|
67
|
+
margin_pool_id: bcs.Address,
|
|
68
|
+
deepbook_pool_id: bcs.Address,
|
|
69
|
+
pool_cap_id: bcs.Address,
|
|
70
|
+
enabled: bcs.bool(),
|
|
71
|
+
timestamp: bcs.u64(),
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
export const InterestParamsUpdated = new MoveStruct({
|
|
75
|
+
name: `${$moduleName}::InterestParamsUpdated`,
|
|
76
|
+
fields: {
|
|
77
|
+
margin_pool_id: bcs.Address,
|
|
78
|
+
pool_cap_id: bcs.Address,
|
|
79
|
+
interest_config: protocol_config.InterestConfig,
|
|
80
|
+
timestamp: bcs.u64(),
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
export const MarginPoolConfigUpdated = new MoveStruct({
|
|
84
|
+
name: `${$moduleName}::MarginPoolConfigUpdated`,
|
|
85
|
+
fields: {
|
|
86
|
+
margin_pool_id: bcs.Address,
|
|
87
|
+
pool_cap_id: bcs.Address,
|
|
88
|
+
margin_pool_config: protocol_config.MarginPoolConfig,
|
|
89
|
+
timestamp: bcs.u64(),
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
export const AssetSupplied = new MoveStruct({
|
|
93
|
+
name: `${$moduleName}::AssetSupplied`,
|
|
94
|
+
fields: {
|
|
95
|
+
margin_pool_id: bcs.Address,
|
|
96
|
+
asset_type: type_name.TypeName,
|
|
97
|
+
supplier_cap_id: bcs.Address,
|
|
98
|
+
supply_amount: bcs.u64(),
|
|
99
|
+
supply_shares: bcs.u64(),
|
|
100
|
+
timestamp: bcs.u64(),
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
export const AssetWithdrawn = new MoveStruct({
|
|
104
|
+
name: `${$moduleName}::AssetWithdrawn`,
|
|
105
|
+
fields: {
|
|
106
|
+
margin_pool_id: bcs.Address,
|
|
107
|
+
asset_type: type_name.TypeName,
|
|
108
|
+
supplier_cap_id: bcs.Address,
|
|
109
|
+
withdraw_amount: bcs.u64(),
|
|
110
|
+
withdraw_shares: bcs.u64(),
|
|
111
|
+
timestamp: bcs.u64(),
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
export const SupplierCapMinted = new MoveStruct({
|
|
115
|
+
name: `${$moduleName}::SupplierCapMinted`,
|
|
116
|
+
fields: {
|
|
117
|
+
supplier_cap_id: bcs.Address,
|
|
118
|
+
timestamp: bcs.u64(),
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
export const SupplyReferralMinted = new MoveStruct({
|
|
122
|
+
name: `${$moduleName}::SupplyReferralMinted`,
|
|
123
|
+
fields: {
|
|
124
|
+
margin_pool_id: bcs.Address,
|
|
125
|
+
supply_referral_id: bcs.Address,
|
|
126
|
+
owner: bcs.Address,
|
|
127
|
+
timestamp: bcs.u64(),
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
export interface CreateMarginPoolArguments {
|
|
131
|
+
registry: RawTransactionArgument<string>;
|
|
132
|
+
config: TransactionArgument;
|
|
133
|
+
maintainerCap: RawTransactionArgument<string>;
|
|
134
|
+
}
|
|
135
|
+
export interface CreateMarginPoolOptions {
|
|
136
|
+
package?: string;
|
|
137
|
+
arguments:
|
|
138
|
+
| CreateMarginPoolArguments
|
|
139
|
+
| [
|
|
140
|
+
registry: RawTransactionArgument<string>,
|
|
141
|
+
config: TransactionArgument,
|
|
142
|
+
maintainerCap: RawTransactionArgument<string>,
|
|
143
|
+
];
|
|
144
|
+
typeArguments: [string];
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Creates and registers a new margin pool. If a same asset pool already exists,
|
|
148
|
+
* abort. Sends a `MarginPoolCap` to the pool creator. Returns the created margin
|
|
149
|
+
* pool id.
|
|
150
|
+
*/
|
|
151
|
+
export function createMarginPool(options: CreateMarginPoolOptions) {
|
|
152
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
153
|
+
const argumentsTypes = [null, null, null, '0x2::clock::Clock'] satisfies (string | null)[];
|
|
154
|
+
const parameterNames = ['registry', 'config', 'maintainerCap'];
|
|
155
|
+
return (tx: Transaction) =>
|
|
156
|
+
tx.moveCall({
|
|
157
|
+
package: packageAddress,
|
|
158
|
+
module: 'margin_pool',
|
|
159
|
+
function: 'create_margin_pool',
|
|
160
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
161
|
+
typeArguments: options.typeArguments,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
export interface EnableDeepbookPoolForLoanArguments {
|
|
165
|
+
self: RawTransactionArgument<string>;
|
|
166
|
+
registry: RawTransactionArgument<string>;
|
|
167
|
+
deepbookPoolId: RawTransactionArgument<string>;
|
|
168
|
+
marginPoolCap: RawTransactionArgument<string>;
|
|
169
|
+
}
|
|
170
|
+
export interface EnableDeepbookPoolForLoanOptions {
|
|
171
|
+
package?: string;
|
|
172
|
+
arguments:
|
|
173
|
+
| EnableDeepbookPoolForLoanArguments
|
|
174
|
+
| [
|
|
175
|
+
self: RawTransactionArgument<string>,
|
|
176
|
+
registry: RawTransactionArgument<string>,
|
|
177
|
+
deepbookPoolId: RawTransactionArgument<string>,
|
|
178
|
+
marginPoolCap: RawTransactionArgument<string>,
|
|
179
|
+
];
|
|
180
|
+
typeArguments: [string];
|
|
181
|
+
}
|
|
182
|
+
/** Allow a margin manager tied to a deepbook pool to borrow from the margin pool. */
|
|
183
|
+
export function enableDeepbookPoolForLoan(options: EnableDeepbookPoolForLoanOptions) {
|
|
184
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
185
|
+
const argumentsTypes = [null, null, '0x2::object::ID', null, '0x2::clock::Clock'] satisfies (
|
|
186
|
+
| string
|
|
187
|
+
| null
|
|
188
|
+
)[];
|
|
189
|
+
const parameterNames = ['self', 'registry', 'deepbookPoolId', 'marginPoolCap'];
|
|
190
|
+
return (tx: Transaction) =>
|
|
191
|
+
tx.moveCall({
|
|
192
|
+
package: packageAddress,
|
|
193
|
+
module: 'margin_pool',
|
|
194
|
+
function: 'enable_deepbook_pool_for_loan',
|
|
195
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
196
|
+
typeArguments: options.typeArguments,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
export interface DisableDeepbookPoolForLoanArguments {
|
|
200
|
+
self: RawTransactionArgument<string>;
|
|
201
|
+
registry: RawTransactionArgument<string>;
|
|
202
|
+
deepbookPoolId: RawTransactionArgument<string>;
|
|
203
|
+
marginPoolCap: RawTransactionArgument<string>;
|
|
204
|
+
}
|
|
205
|
+
export interface DisableDeepbookPoolForLoanOptions {
|
|
206
|
+
package?: string;
|
|
207
|
+
arguments:
|
|
208
|
+
| DisableDeepbookPoolForLoanArguments
|
|
209
|
+
| [
|
|
210
|
+
self: RawTransactionArgument<string>,
|
|
211
|
+
registry: RawTransactionArgument<string>,
|
|
212
|
+
deepbookPoolId: RawTransactionArgument<string>,
|
|
213
|
+
marginPoolCap: RawTransactionArgument<string>,
|
|
214
|
+
];
|
|
215
|
+
typeArguments: [string];
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Disable a margin manager tied to a deepbook pool from borrowing from the margin
|
|
219
|
+
* pool.
|
|
220
|
+
*/
|
|
221
|
+
export function disableDeepbookPoolForLoan(options: DisableDeepbookPoolForLoanOptions) {
|
|
222
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
223
|
+
const argumentsTypes = [null, null, '0x2::object::ID', null, '0x2::clock::Clock'] satisfies (
|
|
224
|
+
| string
|
|
225
|
+
| null
|
|
226
|
+
)[];
|
|
227
|
+
const parameterNames = ['self', 'registry', 'deepbookPoolId', 'marginPoolCap'];
|
|
228
|
+
return (tx: Transaction) =>
|
|
229
|
+
tx.moveCall({
|
|
230
|
+
package: packageAddress,
|
|
231
|
+
module: 'margin_pool',
|
|
232
|
+
function: 'disable_deepbook_pool_for_loan',
|
|
233
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
234
|
+
typeArguments: options.typeArguments,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
export interface UpdateInterestParamsArguments {
|
|
238
|
+
self: RawTransactionArgument<string>;
|
|
239
|
+
registry: RawTransactionArgument<string>;
|
|
240
|
+
interestConfig: TransactionArgument;
|
|
241
|
+
marginPoolCap: RawTransactionArgument<string>;
|
|
242
|
+
}
|
|
243
|
+
export interface UpdateInterestParamsOptions {
|
|
244
|
+
package?: string;
|
|
245
|
+
arguments:
|
|
246
|
+
| UpdateInterestParamsArguments
|
|
247
|
+
| [
|
|
248
|
+
self: RawTransactionArgument<string>,
|
|
249
|
+
registry: RawTransactionArgument<string>,
|
|
250
|
+
interestConfig: TransactionArgument,
|
|
251
|
+
marginPoolCap: RawTransactionArgument<string>,
|
|
252
|
+
];
|
|
253
|
+
typeArguments: [string];
|
|
254
|
+
}
|
|
255
|
+
/** Updates interest params for the margin pool */
|
|
256
|
+
export function updateInterestParams(options: UpdateInterestParamsOptions) {
|
|
257
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
258
|
+
const argumentsTypes = [null, null, null, null, '0x2::clock::Clock'] satisfies (string | null)[];
|
|
259
|
+
const parameterNames = ['self', 'registry', 'interestConfig', 'marginPoolCap'];
|
|
260
|
+
return (tx: Transaction) =>
|
|
261
|
+
tx.moveCall({
|
|
262
|
+
package: packageAddress,
|
|
263
|
+
module: 'margin_pool',
|
|
264
|
+
function: 'update_interest_params',
|
|
265
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
266
|
+
typeArguments: options.typeArguments,
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
export interface UpdateMarginPoolConfigArguments {
|
|
270
|
+
self: RawTransactionArgument<string>;
|
|
271
|
+
registry: RawTransactionArgument<string>;
|
|
272
|
+
marginPoolConfig: TransactionArgument;
|
|
273
|
+
marginPoolCap: RawTransactionArgument<string>;
|
|
274
|
+
}
|
|
275
|
+
export interface UpdateMarginPoolConfigOptions {
|
|
276
|
+
package?: string;
|
|
277
|
+
arguments:
|
|
278
|
+
| UpdateMarginPoolConfigArguments
|
|
279
|
+
| [
|
|
280
|
+
self: RawTransactionArgument<string>,
|
|
281
|
+
registry: RawTransactionArgument<string>,
|
|
282
|
+
marginPoolConfig: TransactionArgument,
|
|
283
|
+
marginPoolCap: RawTransactionArgument<string>,
|
|
284
|
+
];
|
|
285
|
+
typeArguments: [string];
|
|
286
|
+
}
|
|
287
|
+
/** Updates margin pool config */
|
|
288
|
+
export function updateMarginPoolConfig(options: UpdateMarginPoolConfigOptions) {
|
|
289
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
290
|
+
const argumentsTypes = [null, null, null, null, '0x2::clock::Clock'] satisfies (string | null)[];
|
|
291
|
+
const parameterNames = ['self', 'registry', 'marginPoolConfig', 'marginPoolCap'];
|
|
292
|
+
return (tx: Transaction) =>
|
|
293
|
+
tx.moveCall({
|
|
294
|
+
package: packageAddress,
|
|
295
|
+
module: 'margin_pool',
|
|
296
|
+
function: 'update_margin_pool_config',
|
|
297
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
298
|
+
typeArguments: options.typeArguments,
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
export interface AdminInjectCapitalArguments {
|
|
302
|
+
self: RawTransactionArgument<string>;
|
|
303
|
+
AdminCap: RawTransactionArgument<string>;
|
|
304
|
+
coin: RawTransactionArgument<string>;
|
|
305
|
+
}
|
|
306
|
+
export interface AdminInjectCapitalOptions {
|
|
307
|
+
package?: string;
|
|
308
|
+
arguments:
|
|
309
|
+
| AdminInjectCapitalArguments
|
|
310
|
+
| [
|
|
311
|
+
self: RawTransactionArgument<string>,
|
|
312
|
+
AdminCap: RawTransactionArgument<string>,
|
|
313
|
+
coin: RawTransactionArgument<string>,
|
|
314
|
+
];
|
|
315
|
+
typeArguments: [string];
|
|
316
|
+
}
|
|
317
|
+
/** Inject capital into the margin pool without minting supplier shares. */
|
|
318
|
+
export function adminInjectCapital(options: AdminInjectCapitalOptions) {
|
|
319
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
320
|
+
const argumentsTypes = [null, null, null, '0x2::clock::Clock'] satisfies (string | null)[];
|
|
321
|
+
const parameterNames = ['self', 'AdminCap', 'coin'];
|
|
322
|
+
return (tx: Transaction) =>
|
|
323
|
+
tx.moveCall({
|
|
324
|
+
package: packageAddress,
|
|
325
|
+
module: 'margin_pool',
|
|
326
|
+
function: 'admin_inject_capital',
|
|
327
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
328
|
+
typeArguments: options.typeArguments,
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
export interface MintSupplierCapArguments {
|
|
332
|
+
registry: RawTransactionArgument<string>;
|
|
333
|
+
}
|
|
334
|
+
export interface MintSupplierCapOptions {
|
|
335
|
+
package?: string;
|
|
336
|
+
arguments: MintSupplierCapArguments | [registry: RawTransactionArgument<string>];
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Mint a new SupplierCap, which is used to supply and withdraw from margin pools.
|
|
340
|
+
* One SupplierCap can be used to supply and withdraw from multiple margin pools.
|
|
341
|
+
*/
|
|
342
|
+
export function mintSupplierCap(options: MintSupplierCapOptions) {
|
|
343
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
344
|
+
const argumentsTypes = [null, '0x2::clock::Clock'] satisfies (string | null)[];
|
|
345
|
+
const parameterNames = ['registry'];
|
|
346
|
+
return (tx: Transaction) =>
|
|
347
|
+
tx.moveCall({
|
|
348
|
+
package: packageAddress,
|
|
349
|
+
module: 'margin_pool',
|
|
350
|
+
function: 'mint_supplier_cap',
|
|
351
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
export interface SupplyArguments {
|
|
355
|
+
self: RawTransactionArgument<string>;
|
|
356
|
+
registry: RawTransactionArgument<string>;
|
|
357
|
+
supplierCap: RawTransactionArgument<string>;
|
|
358
|
+
coin: RawTransactionArgument<string>;
|
|
359
|
+
referral: RawTransactionArgument<string | null>;
|
|
360
|
+
}
|
|
361
|
+
export interface SupplyOptions {
|
|
362
|
+
package?: string;
|
|
363
|
+
arguments:
|
|
364
|
+
| SupplyArguments
|
|
365
|
+
| [
|
|
366
|
+
self: RawTransactionArgument<string>,
|
|
367
|
+
registry: RawTransactionArgument<string>,
|
|
368
|
+
supplierCap: RawTransactionArgument<string>,
|
|
369
|
+
coin: RawTransactionArgument<string>,
|
|
370
|
+
referral: RawTransactionArgument<string | null>,
|
|
371
|
+
];
|
|
372
|
+
typeArguments: [string];
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Supply to the margin pool using a SupplierCap. Returns the new supply shares.
|
|
376
|
+
* The `referral` parameter should be the ID of a SupplyReferral object if referral
|
|
377
|
+
* tracking is desired.
|
|
378
|
+
*/
|
|
379
|
+
export function supply(options: SupplyOptions) {
|
|
380
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
381
|
+
const argumentsTypes = [
|
|
382
|
+
null,
|
|
383
|
+
null,
|
|
384
|
+
null,
|
|
385
|
+
null,
|
|
386
|
+
'0x1::option::Option<0x2::object::ID>',
|
|
387
|
+
'0x2::clock::Clock',
|
|
388
|
+
] satisfies (string | null)[];
|
|
389
|
+
const parameterNames = ['self', 'registry', 'supplierCap', 'coin', 'referral'];
|
|
390
|
+
return (tx: Transaction) =>
|
|
391
|
+
tx.moveCall({
|
|
392
|
+
package: packageAddress,
|
|
393
|
+
module: 'margin_pool',
|
|
394
|
+
function: 'supply',
|
|
395
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
396
|
+
typeArguments: options.typeArguments,
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
export interface WithdrawArguments {
|
|
400
|
+
self: RawTransactionArgument<string>;
|
|
401
|
+
registry: RawTransactionArgument<string>;
|
|
402
|
+
supplierCap: RawTransactionArgument<string>;
|
|
403
|
+
amount: RawTransactionArgument<number | bigint | null>;
|
|
404
|
+
}
|
|
405
|
+
export interface WithdrawOptions {
|
|
406
|
+
package?: string;
|
|
407
|
+
arguments:
|
|
408
|
+
| WithdrawArguments
|
|
409
|
+
| [
|
|
410
|
+
self: RawTransactionArgument<string>,
|
|
411
|
+
registry: RawTransactionArgument<string>,
|
|
412
|
+
supplierCap: RawTransactionArgument<string>,
|
|
413
|
+
amount: RawTransactionArgument<number | bigint | null>,
|
|
414
|
+
];
|
|
415
|
+
typeArguments: [string];
|
|
416
|
+
}
|
|
417
|
+
/** Withdraw from the margin pool using a SupplierCap. Returns the withdrawn coin. */
|
|
418
|
+
export function withdraw(options: WithdrawOptions) {
|
|
419
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
420
|
+
const argumentsTypes = [
|
|
421
|
+
null,
|
|
422
|
+
null,
|
|
423
|
+
null,
|
|
424
|
+
'0x1::option::Option<u64>',
|
|
425
|
+
'0x2::clock::Clock',
|
|
426
|
+
] satisfies (string | null)[];
|
|
427
|
+
const parameterNames = ['self', 'registry', 'supplierCap', 'amount'];
|
|
428
|
+
return (tx: Transaction) =>
|
|
429
|
+
tx.moveCall({
|
|
430
|
+
package: packageAddress,
|
|
431
|
+
module: 'margin_pool',
|
|
432
|
+
function: 'withdraw',
|
|
433
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
434
|
+
typeArguments: options.typeArguments,
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
export interface MintSupplyReferralArguments {
|
|
438
|
+
self: RawTransactionArgument<string>;
|
|
439
|
+
registry: RawTransactionArgument<string>;
|
|
440
|
+
}
|
|
441
|
+
export interface MintSupplyReferralOptions {
|
|
442
|
+
package?: string;
|
|
443
|
+
arguments:
|
|
444
|
+
| MintSupplyReferralArguments
|
|
445
|
+
| [self: RawTransactionArgument<string>, registry: RawTransactionArgument<string>];
|
|
446
|
+
typeArguments: [string];
|
|
447
|
+
}
|
|
448
|
+
/** Mint a supply referral. */
|
|
449
|
+
export function mintSupplyReferral(options: MintSupplyReferralOptions) {
|
|
450
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
451
|
+
const argumentsTypes = [null, null, '0x2::clock::Clock'] satisfies (string | null)[];
|
|
452
|
+
const parameterNames = ['self', 'registry'];
|
|
453
|
+
return (tx: Transaction) =>
|
|
454
|
+
tx.moveCall({
|
|
455
|
+
package: packageAddress,
|
|
456
|
+
module: 'margin_pool',
|
|
457
|
+
function: 'mint_supply_referral',
|
|
458
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
459
|
+
typeArguments: options.typeArguments,
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
export interface WithdrawReferralFeesArguments {
|
|
463
|
+
self: RawTransactionArgument<string>;
|
|
464
|
+
registry: RawTransactionArgument<string>;
|
|
465
|
+
referral: RawTransactionArgument<string>;
|
|
466
|
+
}
|
|
467
|
+
export interface WithdrawReferralFeesOptions {
|
|
468
|
+
package?: string;
|
|
469
|
+
arguments:
|
|
470
|
+
| WithdrawReferralFeesArguments
|
|
471
|
+
| [
|
|
472
|
+
self: RawTransactionArgument<string>,
|
|
473
|
+
registry: RawTransactionArgument<string>,
|
|
474
|
+
referral: RawTransactionArgument<string>,
|
|
475
|
+
];
|
|
476
|
+
typeArguments: [string];
|
|
477
|
+
}
|
|
478
|
+
/** Withdraw the referral fees. */
|
|
479
|
+
export function withdrawReferralFees(options: WithdrawReferralFeesOptions) {
|
|
480
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
481
|
+
const argumentsTypes = [null, null, null] satisfies (string | null)[];
|
|
482
|
+
const parameterNames = ['self', 'registry', 'referral'];
|
|
483
|
+
return (tx: Transaction) =>
|
|
484
|
+
tx.moveCall({
|
|
485
|
+
package: packageAddress,
|
|
486
|
+
module: 'margin_pool',
|
|
487
|
+
function: 'withdraw_referral_fees',
|
|
488
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
489
|
+
typeArguments: options.typeArguments,
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
export interface AdminWithdrawDefaultReferralFeesArguments {
|
|
493
|
+
self: RawTransactionArgument<string>;
|
|
494
|
+
registry: RawTransactionArgument<string>;
|
|
495
|
+
AdminCap: RawTransactionArgument<string>;
|
|
496
|
+
}
|
|
497
|
+
export interface AdminWithdrawDefaultReferralFeesOptions {
|
|
498
|
+
package?: string;
|
|
499
|
+
arguments:
|
|
500
|
+
| AdminWithdrawDefaultReferralFeesArguments
|
|
501
|
+
| [
|
|
502
|
+
self: RawTransactionArgument<string>,
|
|
503
|
+
registry: RawTransactionArgument<string>,
|
|
504
|
+
AdminCap: RawTransactionArgument<string>,
|
|
505
|
+
];
|
|
506
|
+
typeArguments: [string];
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Withdraw the default referral fees (admin only). The default referral at 0x0
|
|
510
|
+
* doesn't have a SupplyReferral object,
|
|
511
|
+
*/
|
|
512
|
+
export function adminWithdrawDefaultReferralFees(options: AdminWithdrawDefaultReferralFeesOptions) {
|
|
513
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
514
|
+
const argumentsTypes = [null, null, null] satisfies (string | null)[];
|
|
515
|
+
const parameterNames = ['self', 'registry', 'AdminCap'];
|
|
516
|
+
return (tx: Transaction) =>
|
|
517
|
+
tx.moveCall({
|
|
518
|
+
package: packageAddress,
|
|
519
|
+
module: 'margin_pool',
|
|
520
|
+
function: 'admin_withdraw_default_referral_fees',
|
|
521
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
522
|
+
typeArguments: options.typeArguments,
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
export interface WithdrawMaintainerFeesArguments {
|
|
526
|
+
self: RawTransactionArgument<string>;
|
|
527
|
+
registry: RawTransactionArgument<string>;
|
|
528
|
+
marginPoolCap: RawTransactionArgument<string>;
|
|
529
|
+
}
|
|
530
|
+
export interface WithdrawMaintainerFeesOptions {
|
|
531
|
+
package?: string;
|
|
532
|
+
arguments:
|
|
533
|
+
| WithdrawMaintainerFeesArguments
|
|
534
|
+
| [
|
|
535
|
+
self: RawTransactionArgument<string>,
|
|
536
|
+
registry: RawTransactionArgument<string>,
|
|
537
|
+
marginPoolCap: RawTransactionArgument<string>,
|
|
538
|
+
];
|
|
539
|
+
typeArguments: [string];
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Withdraw the maintainer fees. The `margin_pool_cap` parameter is used to ensure
|
|
543
|
+
* the correct margin pool is being withdrawn from.
|
|
544
|
+
*/
|
|
545
|
+
export function withdrawMaintainerFees(options: WithdrawMaintainerFeesOptions) {
|
|
546
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
547
|
+
const argumentsTypes = [null, null, null, '0x2::clock::Clock'] satisfies (string | null)[];
|
|
548
|
+
const parameterNames = ['self', 'registry', 'marginPoolCap'];
|
|
549
|
+
return (tx: Transaction) =>
|
|
550
|
+
tx.moveCall({
|
|
551
|
+
package: packageAddress,
|
|
552
|
+
module: 'margin_pool',
|
|
553
|
+
function: 'withdraw_maintainer_fees',
|
|
554
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
555
|
+
typeArguments: options.typeArguments,
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
export interface WithdrawProtocolFeesArguments {
|
|
559
|
+
self: RawTransactionArgument<string>;
|
|
560
|
+
registry: RawTransactionArgument<string>;
|
|
561
|
+
AdminCap: RawTransactionArgument<string>;
|
|
562
|
+
}
|
|
563
|
+
export interface WithdrawProtocolFeesOptions {
|
|
564
|
+
package?: string;
|
|
565
|
+
arguments:
|
|
566
|
+
| WithdrawProtocolFeesArguments
|
|
567
|
+
| [
|
|
568
|
+
self: RawTransactionArgument<string>,
|
|
569
|
+
registry: RawTransactionArgument<string>,
|
|
570
|
+
AdminCap: RawTransactionArgument<string>,
|
|
571
|
+
];
|
|
572
|
+
typeArguments: [string];
|
|
573
|
+
}
|
|
574
|
+
/** Withdraw the protocol fees. */
|
|
575
|
+
export function withdrawProtocolFees(options: WithdrawProtocolFeesOptions) {
|
|
576
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
577
|
+
const argumentsTypes = [null, null, null, '0x2::clock::Clock'] satisfies (string | null)[];
|
|
578
|
+
const parameterNames = ['self', 'registry', 'AdminCap'];
|
|
579
|
+
return (tx: Transaction) =>
|
|
580
|
+
tx.moveCall({
|
|
581
|
+
package: packageAddress,
|
|
582
|
+
module: 'margin_pool',
|
|
583
|
+
function: 'withdraw_protocol_fees',
|
|
584
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
585
|
+
typeArguments: options.typeArguments,
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
export interface IdArguments {
|
|
589
|
+
self: RawTransactionArgument<string>;
|
|
590
|
+
}
|
|
591
|
+
export interface IdOptions {
|
|
592
|
+
package?: string;
|
|
593
|
+
arguments: IdArguments | [self: RawTransactionArgument<string>];
|
|
594
|
+
typeArguments: [string];
|
|
595
|
+
}
|
|
596
|
+
/** Return the ID of the margin pool. */
|
|
597
|
+
export function id(options: IdOptions) {
|
|
598
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
599
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
600
|
+
const parameterNames = ['self'];
|
|
601
|
+
return (tx: Transaction) =>
|
|
602
|
+
tx.moveCall({
|
|
603
|
+
package: packageAddress,
|
|
604
|
+
module: 'margin_pool',
|
|
605
|
+
function: 'id',
|
|
606
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
607
|
+
typeArguments: options.typeArguments,
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
export interface DeepbookPoolAllowedArguments {
|
|
611
|
+
self: RawTransactionArgument<string>;
|
|
612
|
+
deepbookPoolId: RawTransactionArgument<string>;
|
|
613
|
+
}
|
|
614
|
+
export interface DeepbookPoolAllowedOptions {
|
|
615
|
+
package?: string;
|
|
616
|
+
arguments:
|
|
617
|
+
| DeepbookPoolAllowedArguments
|
|
618
|
+
| [self: RawTransactionArgument<string>, deepbookPoolId: RawTransactionArgument<string>];
|
|
619
|
+
typeArguments: [string];
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Return whether a margin manager for a given deepbook pool is allowed to borrow
|
|
623
|
+
* from the margin pool.
|
|
624
|
+
*/
|
|
625
|
+
export function deepbookPoolAllowed(options: DeepbookPoolAllowedOptions) {
|
|
626
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
627
|
+
const argumentsTypes = [null, '0x2::object::ID'] satisfies (string | null)[];
|
|
628
|
+
const parameterNames = ['self', 'deepbookPoolId'];
|
|
629
|
+
return (tx: Transaction) =>
|
|
630
|
+
tx.moveCall({
|
|
631
|
+
package: packageAddress,
|
|
632
|
+
module: 'margin_pool',
|
|
633
|
+
function: 'deepbook_pool_allowed',
|
|
634
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
635
|
+
typeArguments: options.typeArguments,
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
export interface TotalSupplyArguments {
|
|
639
|
+
self: RawTransactionArgument<string>;
|
|
640
|
+
}
|
|
641
|
+
export interface TotalSupplyOptions {
|
|
642
|
+
package?: string;
|
|
643
|
+
arguments: TotalSupplyArguments | [self: RawTransactionArgument<string>];
|
|
644
|
+
typeArguments: [string];
|
|
645
|
+
}
|
|
646
|
+
/** Return the current total supply of the margin pool. */
|
|
647
|
+
export function totalSupply(options: TotalSupplyOptions) {
|
|
648
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
649
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
650
|
+
const parameterNames = ['self'];
|
|
651
|
+
return (tx: Transaction) =>
|
|
652
|
+
tx.moveCall({
|
|
653
|
+
package: packageAddress,
|
|
654
|
+
module: 'margin_pool',
|
|
655
|
+
function: 'total_supply',
|
|
656
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
657
|
+
typeArguments: options.typeArguments,
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
export interface TotalSupplyWithInterestArguments {
|
|
661
|
+
self: RawTransactionArgument<string>;
|
|
662
|
+
}
|
|
663
|
+
export interface TotalSupplyWithInterestOptions {
|
|
664
|
+
package?: string;
|
|
665
|
+
arguments: TotalSupplyWithInterestArguments | [self: RawTransactionArgument<string>];
|
|
666
|
+
typeArguments: [string];
|
|
667
|
+
}
|
|
668
|
+
/** Return the current total supply of the margin pool including accrued interest. */
|
|
669
|
+
export function totalSupplyWithInterest(options: TotalSupplyWithInterestOptions) {
|
|
670
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
671
|
+
const argumentsTypes = [null, '0x2::clock::Clock'] satisfies (string | null)[];
|
|
672
|
+
const parameterNames = ['self'];
|
|
673
|
+
return (tx: Transaction) =>
|
|
674
|
+
tx.moveCall({
|
|
675
|
+
package: packageAddress,
|
|
676
|
+
module: 'margin_pool',
|
|
677
|
+
function: 'total_supply_with_interest',
|
|
678
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
679
|
+
typeArguments: options.typeArguments,
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
export interface SupplySharesArguments {
|
|
683
|
+
self: RawTransactionArgument<string>;
|
|
684
|
+
}
|
|
685
|
+
export interface SupplySharesOptions {
|
|
686
|
+
package?: string;
|
|
687
|
+
arguments: SupplySharesArguments | [self: RawTransactionArgument<string>];
|
|
688
|
+
typeArguments: [string];
|
|
689
|
+
}
|
|
690
|
+
/** Return the current total supply shares of the margin pool. */
|
|
691
|
+
export function supplyShares(options: SupplySharesOptions) {
|
|
692
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
693
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
694
|
+
const parameterNames = ['self'];
|
|
695
|
+
return (tx: Transaction) =>
|
|
696
|
+
tx.moveCall({
|
|
697
|
+
package: packageAddress,
|
|
698
|
+
module: 'margin_pool',
|
|
699
|
+
function: 'supply_shares',
|
|
700
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
701
|
+
typeArguments: options.typeArguments,
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
export interface SupplyRatioArguments {
|
|
705
|
+
self: RawTransactionArgument<string>;
|
|
706
|
+
}
|
|
707
|
+
export interface SupplyRatioOptions {
|
|
708
|
+
package?: string;
|
|
709
|
+
arguments: SupplyRatioArguments | [self: RawTransactionArgument<string>];
|
|
710
|
+
typeArguments: [string];
|
|
711
|
+
}
|
|
712
|
+
/** Return the current supply ratio of the margin pool. */
|
|
713
|
+
export function supplyRatio(options: SupplyRatioOptions) {
|
|
714
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
715
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
716
|
+
const parameterNames = ['self'];
|
|
717
|
+
return (tx: Transaction) =>
|
|
718
|
+
tx.moveCall({
|
|
719
|
+
package: packageAddress,
|
|
720
|
+
module: 'margin_pool',
|
|
721
|
+
function: 'supply_ratio',
|
|
722
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
723
|
+
typeArguments: options.typeArguments,
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
export interface TotalBorrowArguments {
|
|
727
|
+
self: RawTransactionArgument<string>;
|
|
728
|
+
}
|
|
729
|
+
export interface TotalBorrowOptions {
|
|
730
|
+
package?: string;
|
|
731
|
+
arguments: TotalBorrowArguments | [self: RawTransactionArgument<string>];
|
|
732
|
+
typeArguments: [string];
|
|
733
|
+
}
|
|
734
|
+
/** Return the current total borrow of the margin pool. */
|
|
735
|
+
export function totalBorrow(options: TotalBorrowOptions) {
|
|
736
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
737
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
738
|
+
const parameterNames = ['self'];
|
|
739
|
+
return (tx: Transaction) =>
|
|
740
|
+
tx.moveCall({
|
|
741
|
+
package: packageAddress,
|
|
742
|
+
module: 'margin_pool',
|
|
743
|
+
function: 'total_borrow',
|
|
744
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
745
|
+
typeArguments: options.typeArguments,
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
export interface BorrowSharesArguments {
|
|
749
|
+
self: RawTransactionArgument<string>;
|
|
750
|
+
}
|
|
751
|
+
export interface BorrowSharesOptions {
|
|
752
|
+
package?: string;
|
|
753
|
+
arguments: BorrowSharesArguments | [self: RawTransactionArgument<string>];
|
|
754
|
+
typeArguments: [string];
|
|
755
|
+
}
|
|
756
|
+
/** Return the current total borrow shares of the margin pool. */
|
|
757
|
+
export function borrowShares(options: BorrowSharesOptions) {
|
|
758
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
759
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
760
|
+
const parameterNames = ['self'];
|
|
761
|
+
return (tx: Transaction) =>
|
|
762
|
+
tx.moveCall({
|
|
763
|
+
package: packageAddress,
|
|
764
|
+
module: 'margin_pool',
|
|
765
|
+
function: 'borrow_shares',
|
|
766
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
767
|
+
typeArguments: options.typeArguments,
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
export interface BorrowRatioArguments {
|
|
771
|
+
self: RawTransactionArgument<string>;
|
|
772
|
+
}
|
|
773
|
+
export interface BorrowRatioOptions {
|
|
774
|
+
package?: string;
|
|
775
|
+
arguments: BorrowRatioArguments | [self: RawTransactionArgument<string>];
|
|
776
|
+
typeArguments: [string];
|
|
777
|
+
}
|
|
778
|
+
/** Return the current borrow ratio of the margin pool. */
|
|
779
|
+
export function borrowRatio(options: BorrowRatioOptions) {
|
|
780
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
781
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
782
|
+
const parameterNames = ['self'];
|
|
783
|
+
return (tx: Transaction) =>
|
|
784
|
+
tx.moveCall({
|
|
785
|
+
package: packageAddress,
|
|
786
|
+
module: 'margin_pool',
|
|
787
|
+
function: 'borrow_ratio',
|
|
788
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
789
|
+
typeArguments: options.typeArguments,
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
export interface LastUpdateTimestampArguments {
|
|
793
|
+
self: RawTransactionArgument<string>;
|
|
794
|
+
}
|
|
795
|
+
export interface LastUpdateTimestampOptions {
|
|
796
|
+
package?: string;
|
|
797
|
+
arguments: LastUpdateTimestampArguments | [self: RawTransactionArgument<string>];
|
|
798
|
+
typeArguments: [string];
|
|
799
|
+
}
|
|
800
|
+
/** Return the last update timestamp of the margin pool. */
|
|
801
|
+
export function lastUpdateTimestamp(options: LastUpdateTimestampOptions) {
|
|
802
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
803
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
804
|
+
const parameterNames = ['self'];
|
|
805
|
+
return (tx: Transaction) =>
|
|
806
|
+
tx.moveCall({
|
|
807
|
+
package: packageAddress,
|
|
808
|
+
module: 'margin_pool',
|
|
809
|
+
function: 'last_update_timestamp',
|
|
810
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
811
|
+
typeArguments: options.typeArguments,
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
export interface SupplyCapArguments {
|
|
815
|
+
self: RawTransactionArgument<string>;
|
|
816
|
+
}
|
|
817
|
+
export interface SupplyCapOptions {
|
|
818
|
+
package?: string;
|
|
819
|
+
arguments: SupplyCapArguments | [self: RawTransactionArgument<string>];
|
|
820
|
+
typeArguments: [string];
|
|
821
|
+
}
|
|
822
|
+
/** Return the supply cap of the margin pool. */
|
|
823
|
+
export function supplyCap(options: SupplyCapOptions) {
|
|
824
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
825
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
826
|
+
const parameterNames = ['self'];
|
|
827
|
+
return (tx: Transaction) =>
|
|
828
|
+
tx.moveCall({
|
|
829
|
+
package: packageAddress,
|
|
830
|
+
module: 'margin_pool',
|
|
831
|
+
function: 'supply_cap',
|
|
832
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
833
|
+
typeArguments: options.typeArguments,
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
export interface ProtocolFeesArguments {
|
|
837
|
+
self: RawTransactionArgument<string>;
|
|
838
|
+
}
|
|
839
|
+
export interface ProtocolFeesOptions {
|
|
840
|
+
package?: string;
|
|
841
|
+
arguments: ProtocolFeesArguments | [self: RawTransactionArgument<string>];
|
|
842
|
+
typeArguments: [string];
|
|
843
|
+
}
|
|
844
|
+
/** Return the current protocol fees of the margin pool. */
|
|
845
|
+
export function protocolFees(options: ProtocolFeesOptions) {
|
|
846
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
847
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
848
|
+
const parameterNames = ['self'];
|
|
849
|
+
return (tx: Transaction) =>
|
|
850
|
+
tx.moveCall({
|
|
851
|
+
package: packageAddress,
|
|
852
|
+
module: 'margin_pool',
|
|
853
|
+
function: 'protocol_fees',
|
|
854
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
855
|
+
typeArguments: options.typeArguments,
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
export interface MaxUtilizationRateArguments {
|
|
859
|
+
self: RawTransactionArgument<string>;
|
|
860
|
+
}
|
|
861
|
+
export interface MaxUtilizationRateOptions {
|
|
862
|
+
package?: string;
|
|
863
|
+
arguments: MaxUtilizationRateArguments | [self: RawTransactionArgument<string>];
|
|
864
|
+
typeArguments: [string];
|
|
865
|
+
}
|
|
866
|
+
/** Return the current max utilization rate of the margin pool. */
|
|
867
|
+
export function maxUtilizationRate(options: MaxUtilizationRateOptions) {
|
|
868
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
869
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
870
|
+
const parameterNames = ['self'];
|
|
871
|
+
return (tx: Transaction) =>
|
|
872
|
+
tx.moveCall({
|
|
873
|
+
package: packageAddress,
|
|
874
|
+
module: 'margin_pool',
|
|
875
|
+
function: 'max_utilization_rate',
|
|
876
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
877
|
+
typeArguments: options.typeArguments,
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
export interface ProtocolSpreadArguments {
|
|
881
|
+
self: RawTransactionArgument<string>;
|
|
882
|
+
}
|
|
883
|
+
export interface ProtocolSpreadOptions {
|
|
884
|
+
package?: string;
|
|
885
|
+
arguments: ProtocolSpreadArguments | [self: RawTransactionArgument<string>];
|
|
886
|
+
typeArguments: [string];
|
|
887
|
+
}
|
|
888
|
+
/** Return the current protocol spread of the margin pool. */
|
|
889
|
+
export function protocolSpread(options: ProtocolSpreadOptions) {
|
|
890
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
891
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
892
|
+
const parameterNames = ['self'];
|
|
893
|
+
return (tx: Transaction) =>
|
|
894
|
+
tx.moveCall({
|
|
895
|
+
package: packageAddress,
|
|
896
|
+
module: 'margin_pool',
|
|
897
|
+
function: 'protocol_spread',
|
|
898
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
899
|
+
typeArguments: options.typeArguments,
|
|
900
|
+
});
|
|
901
|
+
}
|
|
902
|
+
export interface MinBorrowArguments {
|
|
903
|
+
self: RawTransactionArgument<string>;
|
|
904
|
+
}
|
|
905
|
+
export interface MinBorrowOptions {
|
|
906
|
+
package?: string;
|
|
907
|
+
arguments: MinBorrowArguments | [self: RawTransactionArgument<string>];
|
|
908
|
+
typeArguments: [string];
|
|
909
|
+
}
|
|
910
|
+
/** Return the current min borrow of the margin pool. */
|
|
911
|
+
export function minBorrow(options: MinBorrowOptions) {
|
|
912
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
913
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
914
|
+
const parameterNames = ['self'];
|
|
915
|
+
return (tx: Transaction) =>
|
|
916
|
+
tx.moveCall({
|
|
917
|
+
package: packageAddress,
|
|
918
|
+
module: 'margin_pool',
|
|
919
|
+
function: 'min_borrow',
|
|
920
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
921
|
+
typeArguments: options.typeArguments,
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
export interface InterestRateArguments {
|
|
925
|
+
self: RawTransactionArgument<string>;
|
|
926
|
+
}
|
|
927
|
+
export interface InterestRateOptions {
|
|
928
|
+
package?: string;
|
|
929
|
+
arguments: InterestRateArguments | [self: RawTransactionArgument<string>];
|
|
930
|
+
typeArguments: [string];
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Return the current interest rate of the margin pool. Represented in 9 decimal
|
|
934
|
+
* places.
|
|
935
|
+
*/
|
|
936
|
+
export function interestRate(options: InterestRateOptions) {
|
|
937
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
938
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
939
|
+
const parameterNames = ['self'];
|
|
940
|
+
return (tx: Transaction) =>
|
|
941
|
+
tx.moveCall({
|
|
942
|
+
package: packageAddress,
|
|
943
|
+
module: 'margin_pool',
|
|
944
|
+
function: 'interest_rate',
|
|
945
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
946
|
+
typeArguments: options.typeArguments,
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
export interface TrueInterestRateArguments {
|
|
950
|
+
self: RawTransactionArgument<string>;
|
|
951
|
+
}
|
|
952
|
+
export interface TrueInterestRateOptions {
|
|
953
|
+
package?: string;
|
|
954
|
+
arguments: TrueInterestRateArguments | [self: RawTransactionArgument<string>];
|
|
955
|
+
typeArguments: [string];
|
|
956
|
+
}
|
|
957
|
+
export function trueInterestRate(options: TrueInterestRateOptions) {
|
|
958
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
959
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
960
|
+
const parameterNames = ['self'];
|
|
961
|
+
return (tx: Transaction) =>
|
|
962
|
+
tx.moveCall({
|
|
963
|
+
package: packageAddress,
|
|
964
|
+
module: 'margin_pool',
|
|
965
|
+
function: 'true_interest_rate',
|
|
966
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
967
|
+
typeArguments: options.typeArguments,
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
export interface UserSupplySharesArguments {
|
|
971
|
+
self: RawTransactionArgument<string>;
|
|
972
|
+
supplierCapId: RawTransactionArgument<string>;
|
|
973
|
+
}
|
|
974
|
+
export interface UserSupplySharesOptions {
|
|
975
|
+
package?: string;
|
|
976
|
+
arguments:
|
|
977
|
+
| UserSupplySharesArguments
|
|
978
|
+
| [self: RawTransactionArgument<string>, supplierCapId: RawTransactionArgument<string>];
|
|
979
|
+
typeArguments: [string];
|
|
980
|
+
}
|
|
981
|
+
/** Return the current user supply shares of the margin pool. */
|
|
982
|
+
export function userSupplyShares(options: UserSupplySharesOptions) {
|
|
983
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
984
|
+
const argumentsTypes = [null, '0x2::object::ID'] satisfies (string | null)[];
|
|
985
|
+
const parameterNames = ['self', 'supplierCapId'];
|
|
986
|
+
return (tx: Transaction) =>
|
|
987
|
+
tx.moveCall({
|
|
988
|
+
package: packageAddress,
|
|
989
|
+
module: 'margin_pool',
|
|
990
|
+
function: 'user_supply_shares',
|
|
991
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
992
|
+
typeArguments: options.typeArguments,
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
export interface VaultBalanceArguments {
|
|
996
|
+
self: RawTransactionArgument<string>;
|
|
997
|
+
}
|
|
998
|
+
export interface VaultBalanceOptions {
|
|
999
|
+
package?: string;
|
|
1000
|
+
arguments: VaultBalanceArguments | [self: RawTransactionArgument<string>];
|
|
1001
|
+
typeArguments: [string];
|
|
1002
|
+
}
|
|
1003
|
+
/** Return the current vault balance of the margin pool. */
|
|
1004
|
+
export function vaultBalance(options: VaultBalanceOptions) {
|
|
1005
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
1006
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
1007
|
+
const parameterNames = ['self'];
|
|
1008
|
+
return (tx: Transaction) =>
|
|
1009
|
+
tx.moveCall({
|
|
1010
|
+
package: packageAddress,
|
|
1011
|
+
module: 'margin_pool',
|
|
1012
|
+
function: 'vault_balance',
|
|
1013
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1014
|
+
typeArguments: options.typeArguments,
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
1017
|
+
export interface UserSupplyAmountArguments {
|
|
1018
|
+
self: RawTransactionArgument<string>;
|
|
1019
|
+
supplierCapId: RawTransactionArgument<string>;
|
|
1020
|
+
}
|
|
1021
|
+
export interface UserSupplyAmountOptions {
|
|
1022
|
+
package?: string;
|
|
1023
|
+
arguments:
|
|
1024
|
+
| UserSupplyAmountArguments
|
|
1025
|
+
| [self: RawTransactionArgument<string>, supplierCapId: RawTransactionArgument<string>];
|
|
1026
|
+
typeArguments: [string];
|
|
1027
|
+
}
|
|
1028
|
+
/** Return the current user supply amount of the margin pool. */
|
|
1029
|
+
export function userSupplyAmount(options: UserSupplyAmountOptions) {
|
|
1030
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
1031
|
+
const argumentsTypes = [null, '0x2::object::ID', '0x2::clock::Clock'] satisfies (string | null)[];
|
|
1032
|
+
const parameterNames = ['self', 'supplierCapId'];
|
|
1033
|
+
return (tx: Transaction) =>
|
|
1034
|
+
tx.moveCall({
|
|
1035
|
+
package: packageAddress,
|
|
1036
|
+
module: 'margin_pool',
|
|
1037
|
+
function: 'user_supply_amount',
|
|
1038
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1039
|
+
typeArguments: options.typeArguments,
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
export interface GetAvailableWithdrawalArguments {
|
|
1043
|
+
self: RawTransactionArgument<string>;
|
|
1044
|
+
}
|
|
1045
|
+
export interface GetAvailableWithdrawalOptions {
|
|
1046
|
+
package?: string;
|
|
1047
|
+
arguments: GetAvailableWithdrawalArguments | [self: RawTransactionArgument<string>];
|
|
1048
|
+
typeArguments: [string];
|
|
1049
|
+
}
|
|
1050
|
+
/** Returns the maximum amount that can be withdrawn without hitting rate limits */
|
|
1051
|
+
export function getAvailableWithdrawal(options: GetAvailableWithdrawalOptions) {
|
|
1052
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
1053
|
+
const argumentsTypes = [null, '0x2::clock::Clock'] satisfies (string | null)[];
|
|
1054
|
+
const parameterNames = ['self'];
|
|
1055
|
+
return (tx: Transaction) =>
|
|
1056
|
+
tx.moveCall({
|
|
1057
|
+
package: packageAddress,
|
|
1058
|
+
module: 'margin_pool',
|
|
1059
|
+
function: 'get_available_withdrawal',
|
|
1060
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1061
|
+
typeArguments: options.typeArguments,
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
export interface IsRateLimitEnabledArguments {
|
|
1065
|
+
self: RawTransactionArgument<string>;
|
|
1066
|
+
}
|
|
1067
|
+
export interface IsRateLimitEnabledOptions {
|
|
1068
|
+
package?: string;
|
|
1069
|
+
arguments: IsRateLimitEnabledArguments | [self: RawTransactionArgument<string>];
|
|
1070
|
+
typeArguments: [string];
|
|
1071
|
+
}
|
|
1072
|
+
/** Returns whether rate limiting is enabled */
|
|
1073
|
+
export function isRateLimitEnabled(options: IsRateLimitEnabledOptions) {
|
|
1074
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
1075
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
1076
|
+
const parameterNames = ['self'];
|
|
1077
|
+
return (tx: Transaction) =>
|
|
1078
|
+
tx.moveCall({
|
|
1079
|
+
package: packageAddress,
|
|
1080
|
+
module: 'margin_pool',
|
|
1081
|
+
function: 'is_rate_limit_enabled',
|
|
1082
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1083
|
+
typeArguments: options.typeArguments,
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
export interface RateLimitCapacityArguments {
|
|
1087
|
+
self: RawTransactionArgument<string>;
|
|
1088
|
+
}
|
|
1089
|
+
export interface RateLimitCapacityOptions {
|
|
1090
|
+
package?: string;
|
|
1091
|
+
arguments: RateLimitCapacityArguments | [self: RawTransactionArgument<string>];
|
|
1092
|
+
typeArguments: [string];
|
|
1093
|
+
}
|
|
1094
|
+
/** Returns the rate limit capacity (max bucket size) */
|
|
1095
|
+
export function rateLimitCapacity(options: RateLimitCapacityOptions) {
|
|
1096
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
1097
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
1098
|
+
const parameterNames = ['self'];
|
|
1099
|
+
return (tx: Transaction) =>
|
|
1100
|
+
tx.moveCall({
|
|
1101
|
+
package: packageAddress,
|
|
1102
|
+
module: 'margin_pool',
|
|
1103
|
+
function: 'rate_limit_capacity',
|
|
1104
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1105
|
+
typeArguments: options.typeArguments,
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
export interface RateLimitRefillRatePerMsArguments {
|
|
1109
|
+
self: RawTransactionArgument<string>;
|
|
1110
|
+
}
|
|
1111
|
+
export interface RateLimitRefillRatePerMsOptions {
|
|
1112
|
+
package?: string;
|
|
1113
|
+
arguments: RateLimitRefillRatePerMsArguments | [self: RawTransactionArgument<string>];
|
|
1114
|
+
typeArguments: [string];
|
|
1115
|
+
}
|
|
1116
|
+
/** Returns the rate limit refill rate per millisecond */
|
|
1117
|
+
export function rateLimitRefillRatePerMs(options: RateLimitRefillRatePerMsOptions) {
|
|
1118
|
+
const packageAddress = options.package ?? '@deepbook/margin';
|
|
1119
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
1120
|
+
const parameterNames = ['self'];
|
|
1121
|
+
return (tx: Transaction) =>
|
|
1122
|
+
tx.moveCall({
|
|
1123
|
+
package: packageAddress,
|
|
1124
|
+
module: 'margin_pool',
|
|
1125
|
+
function: 'rate_limit_refill_rate_per_ms',
|
|
1126
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1127
|
+
typeArguments: options.typeArguments,
|
|
1128
|
+
});
|
|
1129
|
+
}
|