@mysten/deepbook-v3 1.6.4 → 1.6.6
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 +8 -0
- package/dist/client.d.mts +2 -2
- package/dist/contracts/deepbook/deep_price.d.mts +3 -3
- package/dist/contracts/deepbook/order.d.mts +12 -12
- package/dist/contracts/utils/index.d.mts +1 -1
- package/dist/contracts/utils/index.d.mts.map +1 -1
- package/dist/contracts/utils/index.mjs +5 -1
- package/dist/contracts/utils/index.mjs.map +1 -1
- package/dist/transactions/balanceManager.d.mts +12 -12
- package/dist/transactions/deepbook.d.mts +20 -20
- package/dist/transactions/deepbookAdmin.d.mts +4 -4
- package/dist/transactions/marginAdmin.d.mts +7 -7
- package/dist/transactions/marginAdmin.d.mts.map +1 -1
- package/dist/transactions/marginLiquidations.d.mts +3 -3
- package/dist/transactions/marginMaintainer.d.mts +5 -5
- package/dist/transactions/marginManager.d.mts +32 -32
- package/dist/transactions/marginPool.d.mts +18 -18
- package/dist/transactions/marginRegistry.d.mts +16 -16
- package/dist/transactions/marginTPSL.d.mts +10 -10
- package/dist/transactions/poolProxy.d.mts +8 -8
- package/package.json +2 -2
- package/src/contracts/utils/index.ts +49 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MarginProposalParams, PlaceMarginLimitOrderParams, PlaceMarginMarketOrderParams } from "../types/index.mjs";
|
|
2
2
|
import { DeepBookConfig } from "../utils/config.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _mysten_sui_transactions99 from "@mysten/sui/transactions";
|
|
4
4
|
import { Transaction } from "@mysten/sui/transactions";
|
|
5
5
|
|
|
6
6
|
//#region src/transactions/poolProxy.d.ts
|
|
@@ -20,7 +20,7 @@ declare class PoolProxyContract {
|
|
|
20
20
|
* @param {PlaceMarginLimitOrderParams} params Parameters for placing a limit order
|
|
21
21
|
* @returns A function that takes a Transaction object
|
|
22
22
|
*/
|
|
23
|
-
placeLimitOrder: (params: PlaceMarginLimitOrderParams) => (tx: Transaction) =>
|
|
23
|
+
placeLimitOrder: (params: PlaceMarginLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions99.TransactionResult;
|
|
24
24
|
/**
|
|
25
25
|
* @description Place a market order. Enforces a post-trade `risk_ratio >=
|
|
26
26
|
* min_borrow_risk_ratio` invariant on the manager (skipped when the manager
|
|
@@ -28,7 +28,7 @@ declare class PoolProxyContract {
|
|
|
28
28
|
* @param {PlaceMarginMarketOrderParams} params Parameters for placing a market order
|
|
29
29
|
* @returns A function that takes a Transaction object
|
|
30
30
|
*/
|
|
31
|
-
placeMarketOrder: (params: PlaceMarginMarketOrderParams) => (tx: Transaction) =>
|
|
31
|
+
placeMarketOrder: (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions99.TransactionResult;
|
|
32
32
|
/**
|
|
33
33
|
* @description Place a reduce only limit order. Requires the manager to have
|
|
34
34
|
* debt on the relevant side; enforces a monotonic `risk_ratio_after >=
|
|
@@ -37,7 +37,7 @@ declare class PoolProxyContract {
|
|
|
37
37
|
* @param {PlaceMarginLimitOrderParams} params Parameters for placing a reduce only limit order
|
|
38
38
|
* @returns A function that takes a Transaction object
|
|
39
39
|
*/
|
|
40
|
-
placeReduceOnlyLimitOrder: (params: PlaceMarginLimitOrderParams) => (tx: Transaction) =>
|
|
40
|
+
placeReduceOnlyLimitOrder: (params: PlaceMarginLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions99.TransactionResult;
|
|
41
41
|
/**
|
|
42
42
|
* @description Place a reduce only market order. Requires the manager to
|
|
43
43
|
* have debt on the relevant side; enforces a monotonic `risk_ratio_after >=
|
|
@@ -46,7 +46,7 @@ declare class PoolProxyContract {
|
|
|
46
46
|
* @param {PlaceMarginMarketOrderParams} params Parameters for placing a reduce only market order
|
|
47
47
|
* @returns A function that takes a Transaction object
|
|
48
48
|
*/
|
|
49
|
-
placeReduceOnlyMarketOrder: (params: PlaceMarginMarketOrderParams) => (tx: Transaction) =>
|
|
49
|
+
placeReduceOnlyMarketOrder: (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions99.TransactionResult;
|
|
50
50
|
/**
|
|
51
51
|
* @description Place a market order and repay the loan from the fill proceeds.
|
|
52
52
|
* The taker fill settles into the manager's balance, so the proceeds (plus any
|
|
@@ -58,7 +58,7 @@ declare class PoolProxyContract {
|
|
|
58
58
|
* @param {PlaceMarginMarketOrderParams} params Parameters for placing a market order
|
|
59
59
|
* @returns A function that takes a Transaction object
|
|
60
60
|
*/
|
|
61
|
-
placeMarketOrderAndRepayLoan: (params: PlaceMarginMarketOrderParams) => (tx: Transaction) =>
|
|
61
|
+
placeMarketOrderAndRepayLoan: (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions99.TransactionResult;
|
|
62
62
|
/**
|
|
63
63
|
* @description Place a reduce only limit order and repay the loan from the
|
|
64
64
|
* fill proceeds. Requires debt on the relevant side (a bid needs base debt; an
|
|
@@ -68,7 +68,7 @@ declare class PoolProxyContract {
|
|
|
68
68
|
* @param {PlaceMarginLimitOrderParams} params Parameters for placing a reduce only limit order
|
|
69
69
|
* @returns A function that takes a Transaction object
|
|
70
70
|
*/
|
|
71
|
-
placeReduceOnlyLimitOrderAndRepayLoan: (params: PlaceMarginLimitOrderParams) => (tx: Transaction) =>
|
|
71
|
+
placeReduceOnlyLimitOrderAndRepayLoan: (params: PlaceMarginLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions99.TransactionResult;
|
|
72
72
|
/**
|
|
73
73
|
* @description Place a reduce only market order and repay the loan from the
|
|
74
74
|
* fill proceeds. Same reduce-only direction guard as
|
|
@@ -78,7 +78,7 @@ declare class PoolProxyContract {
|
|
|
78
78
|
* @param {PlaceMarginMarketOrderParams} params Parameters for placing a reduce only market order
|
|
79
79
|
* @returns A function that takes a Transaction object
|
|
80
80
|
*/
|
|
81
|
-
placeReduceOnlyMarketOrderAndRepayLoan: (params: PlaceMarginMarketOrderParams) => (tx: Transaction) =>
|
|
81
|
+
placeReduceOnlyMarketOrderAndRepayLoan: (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions99.TransactionResult;
|
|
82
82
|
/**
|
|
83
83
|
* @description Modify an existing order
|
|
84
84
|
* @param {string} marginManagerKey The key to identify the MarginManager
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@mysten/deepbook-v3",
|
|
3
3
|
"author": "Mysten Labs <build@mystenlabs.com>",
|
|
4
4
|
"description": "Sui Deepbook SDK",
|
|
5
|
-
"version": "1.6.
|
|
5
|
+
"version": "1.6.6",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./dist/index.mjs",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"wait-on": "^9.0.10"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@mysten/sui": "^2.
|
|
51
|
+
"@mysten/sui": "^2.26.0"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"clean": "rm -rf tsconfig.tsbuildinfo ./dist",
|
|
@@ -8,7 +8,11 @@ import {
|
|
|
8
8
|
BcsTuple,
|
|
9
9
|
} from '@mysten/sui/bcs';
|
|
10
10
|
import { normalizeStructTag, normalizeSuiAddress } from '@mysten/sui/utils';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
type TransactionArgument,
|
|
13
|
+
type TransactionObjectArgument,
|
|
14
|
+
isArgument,
|
|
15
|
+
} from '@mysten/sui/transactions';
|
|
12
16
|
import { type ClientWithCoreApi, type SuiClientTypes } from '@mysten/sui/client';
|
|
13
17
|
|
|
14
18
|
const MOVE_STDLIB_ADDRESS = normalizeSuiAddress('0x1');
|
|
@@ -106,6 +110,12 @@ export function normalizeMoveArguments(
|
|
|
106
110
|
continue;
|
|
107
111
|
}
|
|
108
112
|
|
|
113
|
+
if (argType === '0x2::accumulator::AccumulatorRoot') {
|
|
114
|
+
// Chain-wide shared singleton at a fixed address (SUI_ACCUMULATOR_ROOT_OBJECT_ID).
|
|
115
|
+
normalizedArgs.push((tx) => tx.object('0xacc'));
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
|
|
109
119
|
if (argType === '0x3::sui_system::SuiSystemState') {
|
|
110
120
|
normalizedArgs.push((tx) => tx.object.system());
|
|
111
121
|
continue;
|
|
@@ -124,7 +134,10 @@ export function normalizeMoveArguments(
|
|
|
124
134
|
throw new Error(`Expected arguments to be passed as an array`);
|
|
125
135
|
}
|
|
126
136
|
const name = parameterNames[index];
|
|
127
|
-
arg =
|
|
137
|
+
arg =
|
|
138
|
+
name !== undefined && Object.prototype.hasOwnProperty.call(args, name)
|
|
139
|
+
? args[name as keyof typeof args]
|
|
140
|
+
: undefined;
|
|
128
141
|
|
|
129
142
|
if (arg === undefined) {
|
|
130
143
|
throw new Error(`Parameter ${name} is required`);
|
|
@@ -157,6 +170,40 @@ export function normalizeMoveArguments(
|
|
|
157
170
|
return normalizedArgs;
|
|
158
171
|
}
|
|
159
172
|
|
|
173
|
+
/* -------------------------- Config-mapped arguments -------------------------- */
|
|
174
|
+
|
|
175
|
+
/** Context passed to config resolver functions. */
|
|
176
|
+
export interface ConfigResolverContext {
|
|
177
|
+
/**
|
|
178
|
+
* The matched parameter's own instantiated type arguments (not the whole function's type
|
|
179
|
+
* argument tuple). Concrete instantiations are canonical type tags; generic positions pass
|
|
180
|
+
* the caller's `typeArguments` strings through as provided.
|
|
181
|
+
*/
|
|
182
|
+
typeArguments: string[];
|
|
183
|
+
/** The package address the generated call will be sent to. */
|
|
184
|
+
packageAddress: string;
|
|
185
|
+
/** The Move module of the generated call. */
|
|
186
|
+
moduleName: string;
|
|
187
|
+
/** The Move function of the generated call. */
|
|
188
|
+
functionName: string;
|
|
189
|
+
/** The Move name of the matched parameter, when the summary includes parameter names. */
|
|
190
|
+
parameterName?: string;
|
|
191
|
+
/** The matched parameter's position in the generated function's arguments. */
|
|
192
|
+
parameterIndex: number;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* A non-callback transaction argument in a generated config object, used for keys whose matched
|
|
197
|
+
* parameter can't be supplied as an object id string.
|
|
198
|
+
*/
|
|
199
|
+
export type ConfigObjectValue = Exclude<TransactionObjectArgument, (...args: never[]) => unknown>;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* A plain value in a generated config object: an object id or a non-callback transaction
|
|
203
|
+
* argument. Keys that can resolve multiple bindings are typed as resolver functions instead.
|
|
204
|
+
*/
|
|
205
|
+
export type ConfigValue = string | ConfigObjectValue;
|
|
206
|
+
|
|
160
207
|
/* -------------------------- Move type tags -------------------------- */
|
|
161
208
|
|
|
162
209
|
/** A type argument: a type tag string, or a BCS type whose name is a Move type. */
|