@mysten/deepbook-v3 2.9.1 → 2.10.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.
- package/CHANGELOG.md +49 -0
- package/README.md +21 -0
- package/dist/account-bindings/account-registry.d.mts +109 -0
- package/dist/account-bindings/account-registry.d.mts.map +1 -0
- package/dist/account-bindings/account-registry.mjs +56 -0
- package/dist/account-bindings/account-registry.mjs.map +1 -0
- package/dist/account-bindings/account.d.mts +176 -0
- package/dist/account-bindings/account.d.mts.map +1 -0
- package/dist/account-bindings/account.mjs +94 -0
- package/dist/account-bindings/account.mjs.map +1 -0
- package/dist/account-bindings/latest.d.mts +12 -0
- package/dist/account-bindings/latest.d.mts.map +1 -0
- package/dist/account-bindings/latest.mjs +19 -0
- package/dist/account-bindings/latest.mjs.map +1 -0
- package/dist/account.d.mts +46 -3
- package/dist/account.d.mts.map +1 -1
- package/dist/account.mjs +51 -2
- package/dist/account.mjs.map +1 -1
- package/dist/client.d.mts +2 -2
- package/dist/contracts/account/account.d.mts +25 -97
- package/dist/contracts/account/account.d.mts.map +1 -1
- package/dist/contracts/account/account.mjs +43 -35
- package/dist/contracts/account/account.mjs.map +1 -1
- package/dist/contracts/account/account_events.d.mts +20 -20
- package/dist/contracts/account/account_events.d.mts.map +1 -1
- package/dist/contracts/account/account_registry.d.mts +7 -54
- package/dist/contracts/account/account_registry.d.mts.map +1 -1
- package/dist/contracts/account/account_registry.mjs +2 -22
- package/dist/contracts/account/account_registry.mjs.map +1 -1
- package/dist/contracts/deepbook/account.d.mts +18 -18
- package/dist/contracts/deepbook/balances.d.mts +4 -4
- package/dist/contracts/deepbook/deep_price.d.mts +3 -3
- package/dist/contracts/deepbook/order.d.mts +12 -12
- package/dist/contracts/deepbook_predict/admin.d.mts +4 -4
- package/dist/contracts/deepbook_predict/admin.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/builder_code.d.mts +60 -13
- package/dist/contracts/deepbook_predict/builder_code.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/builder_code.mjs +55 -1
- package/dist/contracts/deepbook_predict/builder_code.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/builder_code_events.d.mts +10 -10
- package/dist/contracts/deepbook_predict/config_events.d.mts +88 -84
- package/dist/contracts/deepbook_predict/config_events.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/config_events.mjs +8 -0
- package/dist/contracts/deepbook_predict/config_events.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/expiry_market.d.mts +262 -101
- package/dist/contracts/deepbook_predict/expiry_market.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/expiry_market.mjs +320 -41
- package/dist/contracts/deepbook_predict/expiry_market.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/market_lifecycle_cap.d.mts +5 -5
- package/dist/contracts/deepbook_predict/market_lifecycle_cap.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/market_manager.d.mts +27 -27
- package/dist/contracts/deepbook_predict/market_manager.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/order_events.d.mts +56 -54
- package/dist/contracts/deepbook_predict/order_events.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/order_events.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pause_cap.d.mts +5 -5
- package/dist/contracts/deepbook_predict/pause_cap.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/plp.d.mts +74 -74
- package/dist/contracts/deepbook_predict/plp.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/pool_valuation_cap.d.mts +5 -5
- package/dist/contracts/deepbook_predict/pool_valuation_cap.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/predict_account.d.mts +22 -17
- package/dist/contracts/deepbook_predict/predict_account.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/predict_account.mjs +12 -6
- package/dist/contracts/deepbook_predict/predict_account.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pricing.d.mts +67 -67
- package/dist/contracts/deepbook_predict/pricing.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/protocol_config.d.mts +127 -83
- package/dist/contracts/deepbook_predict/protocol_config.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/protocol_config.mjs +59 -1
- package/dist/contracts/deepbook_predict/protocol_config.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/range_codec.d.mts +2 -2
- package/dist/contracts/deepbook_predict/range_codec.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/registry.d.mts +32 -32
- package/dist/contracts/deepbook_predict/registry.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/vault_events.d.mts +131 -131
- package/dist/contracts/deepbook_predict_math/lazer_price.d.mts +13 -13
- package/dist/contracts/deepbook_predict_math/math.d.mts +14 -14
- package/dist/contracts/deepbook_predict_orders/delayed_execution_config.d.mts +30 -30
- package/dist/contracts/deepbook_predict_orders/deps/deepbook_predict/expiry_market.mjs +6 -0
- package/dist/contracts/deepbook_predict_orders/deps/deepbook_predict/expiry_market.mjs.map +1 -1
- package/dist/contracts/deepbook_predict_orders/desk.d.mts +28 -28
- package/dist/contracts/deepbook_predict_orders/desk.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict_orders/order_queue.d.mts +187 -187
- package/dist/contracts/deepbook_predict_orders/queue.d.mts +240 -62
- package/dist/contracts/deepbook_predict_orders/queue.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict_orders/queue.mjs +306 -41
- package/dist/contracts/deepbook_predict_orders/queue.mjs.map +1 -1
- package/dist/contracts/deepbook_predict_orders/queue_events.d.mts +140 -140
- package/dist/contracts/deepbook_sessions/session_config.d.mts +8 -8
- package/dist/contracts/deepbook_sessions/sessions.d.mts +271 -31
- package/dist/contracts/deepbook_sessions/sessions.d.mts.map +1 -1
- package/dist/contracts/deepbook_sessions/sessions.mjs +363 -3
- package/dist/contracts/deepbook_sessions/sessions.mjs.map +1 -1
- package/dist/deployments/mainnet.mjs.map +1 -1
- package/dist/deployments/testnet.d.mts.map +1 -1
- package/dist/deployments/testnet.mjs +7 -4
- package/dist/deployments/testnet.mjs.map +1 -1
- package/dist/predict/bindings/expiry-market.d.mts +57 -7
- package/dist/predict/bindings/expiry-market.d.mts.map +1 -1
- package/dist/predict/bindings/expiry-market.mjs +48 -2
- package/dist/predict/bindings/expiry-market.mjs.map +1 -1
- package/dist/predict/bindings/protocol-config.d.mts +5 -5
- package/dist/predict/bindings/protocol-config.d.mts.map +1 -1
- package/dist/predict/bindings/protocol-config.mjs +4 -1
- package/dist/predict/bindings/protocol-config.mjs.map +1 -1
- package/dist/predict/bindings/queue.d.mts +30 -0
- package/dist/predict/bindings/queue.d.mts.map +1 -0
- package/dist/predict/bindings/queue.mjs +59 -0
- package/dist/predict/bindings/queue.mjs.map +1 -0
- package/dist/predict/bindings/rename.mjs +5 -1
- package/dist/predict/bindings/rename.mjs.map +1 -1
- package/dist/predict/client.d.mts.map +1 -1
- package/dist/predict/client.mjs +11 -5
- package/dist/predict/client.mjs.map +1 -1
- package/dist/predict/config/generated.d.mts +1 -1
- package/dist/predict/config/generated.d.mts.map +1 -1
- package/dist/predict/config/generated.mjs +1 -0
- package/dist/predict/config/generated.mjs.map +1 -1
- package/dist/predict/config/mainnet.mjs +3 -1
- package/dist/predict/config/mainnet.mjs.map +1 -1
- package/dist/predict/config/testnet.mjs +3 -1
- package/dist/predict/config/testnet.mjs.map +1 -1
- package/dist/predict/config/types.d.mts +23 -0
- package/dist/predict/config/types.d.mts.map +1 -1
- package/dist/predict/cost.d.mts +9 -1
- package/dist/predict/cost.d.mts.map +1 -1
- package/dist/predict/cost.mjs.map +1 -1
- package/dist/predict/errors.d.mts.map +1 -1
- package/dist/predict/errors.mjs +6 -2
- package/dist/predict/errors.mjs.map +1 -1
- package/dist/predict/index.d.mts +1 -1
- package/dist/predict/index.mjs +2 -2
- package/dist/predict/queue.d.mts +8 -4
- package/dist/predict/queue.d.mts.map +1 -1
- package/dist/predict/queue.mjs +8 -4
- package/dist/predict/queue.mjs.map +1 -1
- package/dist/predict/reads/balances.mjs +1 -1
- package/dist/predict/reads/pricing.d.mts +1 -0
- package/dist/predict/reads/pricing.d.mts.map +1 -1
- package/dist/predict/reads/queue.d.mts +4 -2
- package/dist/predict/reads/queue.d.mts.map +1 -1
- package/dist/predict/reads/queue.mjs +5 -4
- package/dist/predict/reads/queue.mjs.map +1 -1
- package/dist/predict/tx/authed.mjs +1 -1
- package/dist/predict/tx/common.d.mts.map +1 -1
- package/dist/predict/tx/common.mjs +3 -2
- package/dist/predict/tx/common.mjs.map +1 -1
- package/dist/predict/tx/trade.d.mts.map +1 -1
- package/dist/predict/tx/trade.mjs +3 -2
- package/dist/predict/tx/trade.mjs.map +1 -1
- package/dist/sessions.d.mts +10 -1
- package/dist/sessions.d.mts.map +1 -1
- package/dist/sessions.mjs.map +1 -1
- package/dist/transactions/balanceManager.d.mts +12 -12
- package/dist/transactions/balanceManager.d.mts.map +1 -1
- package/dist/transactions/deepbook.d.mts +20 -20
- package/dist/transactions/deepbook.d.mts.map +1 -1
- package/dist/transactions/deepbookAdmin.d.mts +4 -4
- package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
- 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/marginMaintainer.d.mts.map +1 -1
- package/dist/transactions/marginManager.d.mts +32 -32
- package/dist/transactions/marginPool.d.mts +18 -18
- package/dist/transactions/marginPool.d.mts.map +1 -1
- 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/dist/transactions/poolProxy.d.mts.map +1 -1
- package/dist/utils/constants.d.mts.map +1 -1
- package/dist/utils/constants.mjs +1 -1
- package/dist/utils/constants.mjs.map +1 -1
- package/package.json +2 -2
- package/src/account-bindings/account-registry.ts +39 -0
- package/src/account-bindings/account.ts +73 -0
- package/src/account-bindings/latest.ts +41 -0
- package/src/account.ts +89 -5
- package/src/contracts/account/account.ts +73 -4
- package/src/contracts/account/account_registry.ts +1 -1
- package/src/contracts/deepbook_predict/builder_code.ts +94 -2
- package/src/contracts/deepbook_predict/config_events.ts +7 -0
- package/src/contracts/deepbook_predict/expiry_market.ts +490 -44
- package/src/contracts/deepbook_predict/order_events.ts +6 -4
- package/src/contracts/deepbook_predict/predict_account.ts +12 -6
- package/src/contracts/deepbook_predict/protocol_config.ts +85 -0
- package/src/contracts/deepbook_predict_orders/deps/deepbook_predict/expiry_market.ts +14 -0
- package/src/contracts/deepbook_predict_orders/order_flow.ts +4 -0
- package/src/contracts/deepbook_predict_orders/queue.ts +495 -9
- package/src/contracts/deepbook_sessions/sessions.ts +538 -3
- package/src/deployments/mainnet.ts +4 -4
- package/src/deployments/testnet.ts +18 -7
- package/src/deployments/types.ts +14 -0
- package/src/predict/bindings/expiry-market.ts +87 -0
- package/src/predict/bindings/queue.ts +42 -0
- package/src/predict/bindings/rename.ts +5 -1
- package/src/predict/client.ts +25 -3
- package/src/predict/config/generated.ts +3 -0
- package/src/predict/config/mainnet.ts +4 -0
- package/src/predict/config/testnet.ts +4 -0
- package/src/predict/config/types.ts +23 -0
- package/src/predict/cost.ts +9 -1
- package/src/predict/errors.ts +11 -1
- package/src/predict/index.ts +1 -1
- package/src/predict/queue.ts +8 -4
- package/src/predict/reads/queue.ts +7 -4
- package/src/predict/tx/common.ts +2 -0
- package/src/predict/tx/trade.ts +3 -1
- package/src/sessions.ts +10 -1
- package/src/utils/constants.ts +5 -1
|
@@ -23,6 +23,12 @@
|
|
|
23
23
|
* the settled payout need only the receipt. The queue itself, its escrow, its
|
|
24
24
|
* policy, and its events live in the companion.
|
|
25
25
|
*
|
|
26
|
+
* A trade that pays a builder names its code and fee per contract
|
|
27
|
+
* (`builder_code::BuilderFee`). `admit_mint_with_builder` and
|
|
28
|
+
* `admit_sell_with_builder` cap the fee at `protocol_config::builder_fee_cap` and
|
|
29
|
+
* record the code and the capped fee in the receipt, and the fill charges what the
|
|
30
|
+
* receipt records. The plain admissions name no builder and charge none.
|
|
31
|
+
*
|
|
26
32
|
* Mainnet USDC is a regulated coin: Sui aborts a transaction that sends it to an
|
|
27
33
|
* address on its deny list, or to anyone while it is globally paused. So the fill,
|
|
28
34
|
* the fee routing, and the settled payout read `sui::deny_list` first and never
|
|
@@ -139,10 +145,18 @@ export const OrderReceipt = new MoveStruct({
|
|
|
139
145
|
higher_tick: U64,
|
|
140
146
|
/** The exact mint quantity, or the sell's close quantity. */
|
|
141
147
|
quantity: U64,
|
|
148
|
+
/**
|
|
149
|
+
* A mint's premium cap. A sell never uses it, so a sell admitted with a builder
|
|
150
|
+
* keeps its capped builder fee per contract here.
|
|
151
|
+
*/
|
|
142
152
|
max_premium: U64,
|
|
143
153
|
min_quantity: U64,
|
|
144
154
|
max_probability: U64,
|
|
145
155
|
min_probability: U64,
|
|
156
|
+
/**
|
|
157
|
+
* A sell's proceeds floor. A mint never uses it, so a mint admitted with a builder
|
|
158
|
+
* keeps its capped builder fee per contract here.
|
|
159
|
+
*/
|
|
146
160
|
min_proceeds: U64,
|
|
147
161
|
/** Earliest Pyth generation time the order may price at. */
|
|
148
162
|
tau_ms: U64,
|
|
@@ -1001,7 +1015,8 @@ export interface QuoteMintForAccountOptions {
|
|
|
1001
1015
|
}
|
|
1002
1016
|
/**
|
|
1003
1017
|
* `quote_mint` for the wrapper's account: `max_premium` is capped at the account's
|
|
1004
|
-
* balance
|
|
1018
|
+
* balance. No builder fee, matching the enqueue calls that name no builder:
|
|
1019
|
+
* `quote_mint_with_builder_fee` at a zero fee.
|
|
1005
1020
|
*/
|
|
1006
1021
|
export function quoteMintForAccount(options: QuoteMintForAccountOptions) {
|
|
1007
1022
|
const packageAddress =
|
|
@@ -1045,6 +1060,77 @@ export function quoteMintForAccount(options: QuoteMintForAccountOptions) {
|
|
|
1045
1060
|
),
|
|
1046
1061
|
});
|
|
1047
1062
|
}
|
|
1063
|
+
export interface QuoteMintWithBuilderFeeArguments {
|
|
1064
|
+
market: RawTransactionArgument<string>;
|
|
1065
|
+
wrapper: RawTransactionArgument<string>;
|
|
1066
|
+
config?: RawTransactionArgument<string>;
|
|
1067
|
+
pricer: TransactionArgument;
|
|
1068
|
+
lowerTick: RawTransactionArgument<number | bigint>;
|
|
1069
|
+
higherTick: RawTransactionArgument<number | bigint>;
|
|
1070
|
+
maxPremium: RawTransactionArgument<number | bigint>;
|
|
1071
|
+
minQuantity: RawTransactionArgument<number | bigint>;
|
|
1072
|
+
exactQuantity: RawTransactionArgument<boolean>;
|
|
1073
|
+
builderFeePerContract: RawTransactionArgument<number | bigint>;
|
|
1074
|
+
}
|
|
1075
|
+
export interface QuoteMintWithBuilderFeeOptions {
|
|
1076
|
+
package?: string;
|
|
1077
|
+
arguments: QuoteMintWithBuilderFeeArguments;
|
|
1078
|
+
config?: {
|
|
1079
|
+
protocolConfig: ConfigValue;
|
|
1080
|
+
predictPackageId?: string;
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* `quote_mint_for_account` for an order that names a builder: charges
|
|
1085
|
+
* `builder_fee_per_contract`, in FLOAT_SCALING of the $1 payout, capped at
|
|
1086
|
+
* `protocol_config::builder_fee_cap` as admission caps it. Prices and gates like
|
|
1087
|
+
* `quote_mint`. For SDK and devInspect previews of the `_with_builder` enqueue
|
|
1088
|
+
* calls.
|
|
1089
|
+
*/
|
|
1090
|
+
export function quoteMintWithBuilderFee(options: QuoteMintWithBuilderFeeOptions) {
|
|
1091
|
+
const packageAddress =
|
|
1092
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
1093
|
+
const argumentsTypes = [
|
|
1094
|
+
null,
|
|
1095
|
+
null,
|
|
1096
|
+
null,
|
|
1097
|
+
null,
|
|
1098
|
+
'u64',
|
|
1099
|
+
'u64',
|
|
1100
|
+
'u64',
|
|
1101
|
+
'u64',
|
|
1102
|
+
'bool',
|
|
1103
|
+
'u64',
|
|
1104
|
+
'0x2::accumulator::AccumulatorRoot',
|
|
1105
|
+
'0x2::clock::Clock',
|
|
1106
|
+
] satisfies (string | null)[];
|
|
1107
|
+
const parameterNames = [
|
|
1108
|
+
'market',
|
|
1109
|
+
'wrapper',
|
|
1110
|
+
'config',
|
|
1111
|
+
'pricer',
|
|
1112
|
+
'lowerTick',
|
|
1113
|
+
'higherTick',
|
|
1114
|
+
'maxPremium',
|
|
1115
|
+
'minQuantity',
|
|
1116
|
+
'exactQuantity',
|
|
1117
|
+
'builderFeePerContract',
|
|
1118
|
+
];
|
|
1119
|
+
return (tx: Transaction) =>
|
|
1120
|
+
tx.moveCall({
|
|
1121
|
+
package: packageAddress,
|
|
1122
|
+
module: 'expiry_market',
|
|
1123
|
+
function: 'quote_mint_with_builder_fee',
|
|
1124
|
+
arguments: normalizeMoveArguments(
|
|
1125
|
+
{
|
|
1126
|
+
...options.arguments,
|
|
1127
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
1128
|
+
},
|
|
1129
|
+
argumentsTypes,
|
|
1130
|
+
parameterNames,
|
|
1131
|
+
),
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1048
1134
|
export interface QuoteMintExactCostForAccountArguments {
|
|
1049
1135
|
market: RawTransactionArgument<string>;
|
|
1050
1136
|
wrapper: RawTransactionArgument<string>;
|
|
@@ -1066,8 +1152,9 @@ export interface QuoteMintExactCostForAccountOptions {
|
|
|
1066
1152
|
/**
|
|
1067
1153
|
* Quote the largest mint whose all-in cost fits `min(max_cost, account balance)`,
|
|
1068
1154
|
* at least `min_quantity`, for the wrapper's account, priced like a queued
|
|
1069
|
-
* exact-cost fill at the clock.
|
|
1070
|
-
*
|
|
1155
|
+
* exact-cost fill at the clock. No builder fee, matching the enqueue calls that
|
|
1156
|
+
* name no builder: `quote_mint_exact_cost_with_builder_fee` at a zero fee.
|
|
1157
|
+
* Otherwise prices and gates like `quote_mint`.
|
|
1071
1158
|
*/
|
|
1072
1159
|
export function quoteMintExactCostForAccount(options: QuoteMintExactCostForAccountOptions) {
|
|
1073
1160
|
const packageAddress =
|
|
@@ -1109,6 +1196,73 @@ export function quoteMintExactCostForAccount(options: QuoteMintExactCostForAccou
|
|
|
1109
1196
|
),
|
|
1110
1197
|
});
|
|
1111
1198
|
}
|
|
1199
|
+
export interface QuoteMintExactCostWithBuilderFeeArguments {
|
|
1200
|
+
market: RawTransactionArgument<string>;
|
|
1201
|
+
wrapper: RawTransactionArgument<string>;
|
|
1202
|
+
config?: RawTransactionArgument<string>;
|
|
1203
|
+
pricer: TransactionArgument;
|
|
1204
|
+
lowerTick: RawTransactionArgument<number | bigint>;
|
|
1205
|
+
higherTick: RawTransactionArgument<number | bigint>;
|
|
1206
|
+
maxCost: RawTransactionArgument<number | bigint>;
|
|
1207
|
+
minQuantity: RawTransactionArgument<number | bigint>;
|
|
1208
|
+
builderFeePerContract: RawTransactionArgument<number | bigint>;
|
|
1209
|
+
}
|
|
1210
|
+
export interface QuoteMintExactCostWithBuilderFeeOptions {
|
|
1211
|
+
package?: string;
|
|
1212
|
+
arguments: QuoteMintExactCostWithBuilderFeeArguments;
|
|
1213
|
+
config?: {
|
|
1214
|
+
protocolConfig: ConfigValue;
|
|
1215
|
+
predictPackageId?: string;
|
|
1216
|
+
};
|
|
1217
|
+
}
|
|
1218
|
+
/**
|
|
1219
|
+
* `quote_mint_exact_cost_for_account` for an order that names a builder: the
|
|
1220
|
+
* budget search fits `builder_fee_per_contract`, in FLOAT_SCALING of the $1 payout
|
|
1221
|
+
* and capped at `protocol_config::builder_fee_cap`, inside the budget. For SDK and
|
|
1222
|
+
* devInspect previews of `enqueue_exact_cost_with_builder`.
|
|
1223
|
+
*/
|
|
1224
|
+
export function quoteMintExactCostWithBuilderFee(options: QuoteMintExactCostWithBuilderFeeOptions) {
|
|
1225
|
+
const packageAddress =
|
|
1226
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
1227
|
+
const argumentsTypes = [
|
|
1228
|
+
null,
|
|
1229
|
+
null,
|
|
1230
|
+
null,
|
|
1231
|
+
null,
|
|
1232
|
+
'u64',
|
|
1233
|
+
'u64',
|
|
1234
|
+
'u64',
|
|
1235
|
+
'u64',
|
|
1236
|
+
'u64',
|
|
1237
|
+
'0x2::accumulator::AccumulatorRoot',
|
|
1238
|
+
'0x2::clock::Clock',
|
|
1239
|
+
] satisfies (string | null)[];
|
|
1240
|
+
const parameterNames = [
|
|
1241
|
+
'market',
|
|
1242
|
+
'wrapper',
|
|
1243
|
+
'config',
|
|
1244
|
+
'pricer',
|
|
1245
|
+
'lowerTick',
|
|
1246
|
+
'higherTick',
|
|
1247
|
+
'maxCost',
|
|
1248
|
+
'minQuantity',
|
|
1249
|
+
'builderFeePerContract',
|
|
1250
|
+
];
|
|
1251
|
+
return (tx: Transaction) =>
|
|
1252
|
+
tx.moveCall({
|
|
1253
|
+
package: packageAddress,
|
|
1254
|
+
module: 'expiry_market',
|
|
1255
|
+
function: 'quote_mint_exact_cost_with_builder_fee',
|
|
1256
|
+
arguments: normalizeMoveArguments(
|
|
1257
|
+
{
|
|
1258
|
+
...options.arguments,
|
|
1259
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
1260
|
+
},
|
|
1261
|
+
argumentsTypes,
|
|
1262
|
+
parameterNames,
|
|
1263
|
+
),
|
|
1264
|
+
});
|
|
1265
|
+
}
|
|
1112
1266
|
export interface OrderFlowStateArguments {
|
|
1113
1267
|
market: RawTransactionArgument<string>;
|
|
1114
1268
|
}
|
|
@@ -1169,6 +1323,35 @@ export function receiptInfo(options: ReceiptInfoOptions) {
|
|
|
1169
1323
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1170
1324
|
});
|
|
1171
1325
|
}
|
|
1326
|
+
export interface BuilderFeePerContractArguments {
|
|
1327
|
+
receipt: TransactionArgument;
|
|
1328
|
+
}
|
|
1329
|
+
export interface BuilderFeePerContractOptions {
|
|
1330
|
+
package?: string;
|
|
1331
|
+
arguments: BuilderFeePerContractArguments | [receipt: TransactionArgument];
|
|
1332
|
+
config?: {
|
|
1333
|
+
predictPackageId?: string;
|
|
1334
|
+
};
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* Return the capped builder fee per contract an admitted order pays at its fill,
|
|
1338
|
+
* which the fill charges to the code the receipt records: `0` for an order that
|
|
1339
|
+
* names no builder and for an open receipt. For the order-flow companion's reads
|
|
1340
|
+
* and SDK previews of a waiting order.
|
|
1341
|
+
*/
|
|
1342
|
+
export function builderFeePerContract(options: BuilderFeePerContractOptions) {
|
|
1343
|
+
const packageAddress =
|
|
1344
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
1345
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
1346
|
+
const parameterNames = ['receipt'];
|
|
1347
|
+
return (tx: Transaction) =>
|
|
1348
|
+
tx.moveCall({
|
|
1349
|
+
package: packageAddress,
|
|
1350
|
+
module: 'expiry_market',
|
|
1351
|
+
function: 'builder_fee_per_contract',
|
|
1352
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1172
1355
|
export interface QuantityArguments {
|
|
1173
1356
|
quote: TransactionArgument;
|
|
1174
1357
|
}
|
|
@@ -1534,7 +1717,7 @@ export interface QuoteCloseArguments {
|
|
|
1534
1717
|
pricer: TransactionArgument;
|
|
1535
1718
|
receipt: TransactionArgument;
|
|
1536
1719
|
closeQuantity: RawTransactionArgument<number | bigint>;
|
|
1537
|
-
|
|
1720
|
+
BuilderCodeId: RawTransactionArgument<string | null>;
|
|
1538
1721
|
}
|
|
1539
1722
|
export interface QuoteCloseOptions {
|
|
1540
1723
|
package?: string;
|
|
@@ -1545,7 +1728,7 @@ export interface QuoteCloseOptions {
|
|
|
1545
1728
|
pricer: TransactionArgument,
|
|
1546
1729
|
receipt: TransactionArgument,
|
|
1547
1730
|
closeQuantity: RawTransactionArgument<number | bigint>,
|
|
1548
|
-
|
|
1731
|
+
BuilderCodeId: RawTransactionArgument<string | null>,
|
|
1549
1732
|
];
|
|
1550
1733
|
config?: {
|
|
1551
1734
|
predictPackageId?: string;
|
|
@@ -1553,13 +1736,14 @@ export interface QuoteCloseOptions {
|
|
|
1553
1736
|
}
|
|
1554
1737
|
/**
|
|
1555
1738
|
* Quote an early sell of `close_quantity` of an open receipt's position at a
|
|
1556
|
-
* market-bound `Pricer` and the clock
|
|
1557
|
-
*
|
|
1558
|
-
* the
|
|
1559
|
-
*
|
|
1560
|
-
* (`
|
|
1561
|
-
*
|
|
1562
|
-
*
|
|
1739
|
+
* market-bound `Pricer` and the clock: the close a sell fill prices, without the
|
|
1740
|
+
* trader's floors. `proceeds` is before the order fee. No builder fee, matching
|
|
1741
|
+
* the sell enqueue that names no builder, whatever `_builder_code_id` names;
|
|
1742
|
+
* `quote_close_with_builder_fee` quotes one that does. Changes nothing. Aborts on
|
|
1743
|
+
* the pricer binding (`EWrongPricer`), another market's receipt (`EWrongMarket`),
|
|
1744
|
+
* a receipt that is not open (`EWrongStage`), `now >= expiry`
|
|
1745
|
+
* (`EInvalidOrderTiming`), or a close that cannot be priced (`EOrderFailsLimits`).
|
|
1746
|
+
* Public for the order-flow companion's sell preview and SDK reads.
|
|
1563
1747
|
*/
|
|
1564
1748
|
export function quoteClose(options: QuoteCloseOptions) {
|
|
1565
1749
|
const packageAddress =
|
|
@@ -1572,7 +1756,7 @@ export function quoteClose(options: QuoteCloseOptions) {
|
|
|
1572
1756
|
'0x1::option::Option<0x2::object::ID>',
|
|
1573
1757
|
'0x2::clock::Clock',
|
|
1574
1758
|
] satisfies (string | null)[];
|
|
1575
|
-
const parameterNames = ['market', 'pricer', 'receipt', 'closeQuantity', '
|
|
1759
|
+
const parameterNames = ['market', 'pricer', 'receipt', 'closeQuantity', 'BuilderCodeId'];
|
|
1576
1760
|
return (tx: Transaction) =>
|
|
1577
1761
|
tx.moveCall({
|
|
1578
1762
|
package: packageAddress,
|
|
@@ -1581,6 +1765,58 @@ export function quoteClose(options: QuoteCloseOptions) {
|
|
|
1581
1765
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1582
1766
|
});
|
|
1583
1767
|
}
|
|
1768
|
+
export interface QuoteCloseWithBuilderFeeArguments {
|
|
1769
|
+
market: RawTransactionArgument<string>;
|
|
1770
|
+
config?: RawTransactionArgument<string>;
|
|
1771
|
+
pricer: TransactionArgument;
|
|
1772
|
+
receipt: TransactionArgument;
|
|
1773
|
+
closeQuantity: RawTransactionArgument<number | bigint>;
|
|
1774
|
+
builderFeePerContract: RawTransactionArgument<number | bigint>;
|
|
1775
|
+
}
|
|
1776
|
+
export interface QuoteCloseWithBuilderFeeOptions {
|
|
1777
|
+
package?: string;
|
|
1778
|
+
arguments: QuoteCloseWithBuilderFeeArguments;
|
|
1779
|
+
config?: {
|
|
1780
|
+
protocolConfig: ConfigValue;
|
|
1781
|
+
predictPackageId?: string;
|
|
1782
|
+
};
|
|
1783
|
+
}
|
|
1784
|
+
/**
|
|
1785
|
+
* `quote_close` for a sell that names a builder: charges
|
|
1786
|
+
* `builder_fee_per_contract`, in FLOAT_SCALING of the $1 payout, capped at
|
|
1787
|
+
* `protocol_config::builder_fee_cap` and then at the redeem value left after the
|
|
1788
|
+
* trading fee, as the fill charges it. Public for the order-flow companion's sell
|
|
1789
|
+
* preview and SDK reads.
|
|
1790
|
+
*/
|
|
1791
|
+
export function quoteCloseWithBuilderFee(options: QuoteCloseWithBuilderFeeOptions) {
|
|
1792
|
+
const packageAddress =
|
|
1793
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
1794
|
+
const argumentsTypes = [null, null, null, null, 'u64', 'u64', '0x2::clock::Clock'] satisfies (
|
|
1795
|
+
string | null
|
|
1796
|
+
)[];
|
|
1797
|
+
const parameterNames = [
|
|
1798
|
+
'market',
|
|
1799
|
+
'config',
|
|
1800
|
+
'pricer',
|
|
1801
|
+
'receipt',
|
|
1802
|
+
'closeQuantity',
|
|
1803
|
+
'builderFeePerContract',
|
|
1804
|
+
];
|
|
1805
|
+
return (tx: Transaction) =>
|
|
1806
|
+
tx.moveCall({
|
|
1807
|
+
package: packageAddress,
|
|
1808
|
+
module: 'expiry_market',
|
|
1809
|
+
function: 'quote_close_with_builder_fee',
|
|
1810
|
+
arguments: normalizeMoveArguments(
|
|
1811
|
+
{
|
|
1812
|
+
...options.arguments,
|
|
1813
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
1814
|
+
},
|
|
1815
|
+
argumentsTypes,
|
|
1816
|
+
parameterNames,
|
|
1817
|
+
),
|
|
1818
|
+
});
|
|
1819
|
+
}
|
|
1584
1820
|
export interface MintExactQuantityArguments {
|
|
1585
1821
|
Market: RawTransactionArgument<string>;
|
|
1586
1822
|
Wrapper: RawTransactionArgument<string>;
|
|
@@ -1803,8 +2039,7 @@ export interface RedeemLiveOptions {
|
|
|
1803
2039
|
}
|
|
1804
2040
|
/**
|
|
1805
2041
|
* Retired by delayed execution: always aborts `EDelayedExecutionRequired`. Early
|
|
1806
|
-
* sells of queue-held positions go through the order-flow companion
|
|
1807
|
-
* positions exit through `redeem_settled` after settlement.
|
|
2042
|
+
* sells of queue-held positions go through the order-flow companion.
|
|
1808
2043
|
*/
|
|
1809
2044
|
export function redeemLive(options: RedeemLiveOptions) {
|
|
1810
2045
|
const packageAddress =
|
|
@@ -1849,11 +2084,11 @@ export function redeemLive(options: RedeemLiveOptions) {
|
|
|
1849
2084
|
});
|
|
1850
2085
|
}
|
|
1851
2086
|
export interface RedeemSettledArguments {
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
2087
|
+
Market: RawTransactionArgument<string>;
|
|
2088
|
+
Wrapper: RawTransactionArgument<string>;
|
|
2089
|
+
Auth: TransactionArgument;
|
|
2090
|
+
Config?: RawTransactionArgument<string>;
|
|
2091
|
+
OrderId: RawTransactionArgument<number | bigint>;
|
|
1857
2092
|
}
|
|
1858
2093
|
export interface RedeemSettledOptions {
|
|
1859
2094
|
package?: string;
|
|
@@ -1864,11 +2099,10 @@ export interface RedeemSettledOptions {
|
|
|
1864
2099
|
};
|
|
1865
2100
|
}
|
|
1866
2101
|
/**
|
|
1867
|
-
*
|
|
1868
|
-
*
|
|
1869
|
-
*
|
|
1870
|
-
*
|
|
1871
|
-
* deauthorized; another authorized app may also supply valid account auth.
|
|
2102
|
+
* Retired by delayed execution: always aborts `EDelayedExecutionRequired`. A
|
|
2103
|
+
* queued fill never enters the account; the order-flow companion pays its Open
|
|
2104
|
+
* record at settlement. Positions the immediate mints left in accounts must be
|
|
2105
|
+
* redeemed through an older package before the watermark bump.
|
|
1872
2106
|
*/
|
|
1873
2107
|
export function redeemSettled(options: RedeemSettledOptions) {
|
|
1874
2108
|
const packageAddress =
|
|
@@ -1882,7 +2116,7 @@ export function redeemSettled(options: RedeemSettledOptions) {
|
|
|
1882
2116
|
'0x2::accumulator::AccumulatorRoot',
|
|
1883
2117
|
'0x2::clock::Clock',
|
|
1884
2118
|
] satisfies (string | null)[];
|
|
1885
|
-
const parameterNames = ['
|
|
2119
|
+
const parameterNames = ['Market', 'Wrapper', 'Auth', 'Config', 'OrderId'];
|
|
1886
2120
|
return (tx: Transaction) =>
|
|
1887
2121
|
tx.moveCall({
|
|
1888
2122
|
package: packageAddress,
|
|
@@ -1891,7 +2125,7 @@ export function redeemSettled(options: RedeemSettledOptions) {
|
|
|
1891
2125
|
arguments: normalizeMoveArguments(
|
|
1892
2126
|
{
|
|
1893
2127
|
...options.arguments,
|
|
1894
|
-
|
|
2128
|
+
Config: options.arguments?.Config ?? options.config?.protocolConfig,
|
|
1895
2129
|
},
|
|
1896
2130
|
argumentsTypes,
|
|
1897
2131
|
parameterNames,
|
|
@@ -1899,11 +2133,11 @@ export function redeemSettled(options: RedeemSettledOptions) {
|
|
|
1899
2133
|
});
|
|
1900
2134
|
}
|
|
1901
2135
|
export interface RedeemSettledPermissionlessArguments {
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
2136
|
+
Market: RawTransactionArgument<string>;
|
|
2137
|
+
AccountRegistry: RawTransactionArgument<string>;
|
|
2138
|
+
Wrapper: RawTransactionArgument<string>;
|
|
2139
|
+
Config?: RawTransactionArgument<string>;
|
|
2140
|
+
OrderId: RawTransactionArgument<number | bigint>;
|
|
1907
2141
|
}
|
|
1908
2142
|
export interface RedeemSettledPermissionlessOptions {
|
|
1909
2143
|
package?: string;
|
|
@@ -1914,15 +2148,8 @@ export interface RedeemSettledPermissionlessOptions {
|
|
|
1914
2148
|
};
|
|
1915
2149
|
}
|
|
1916
2150
|
/**
|
|
1917
|
-
*
|
|
1918
|
-
* keeper.
|
|
1919
|
-
*
|
|
1920
|
-
* Despite the name, only a sender admin has added through
|
|
1921
|
-
* `protocol_config::add_settled_redeem_keeper` may call this; the allowlist starts
|
|
1922
|
-
* empty. The payout still goes to the order's account. This keeper path uses
|
|
1923
|
-
* Predict app-auth from the account registry, so `deauthorize_app<PredictApp>`
|
|
1924
|
-
* also disables it. Owners can still use `redeem_settled` with owner auth to
|
|
1925
|
-
* redeem their own settled positions.
|
|
2151
|
+
* Retired with `redeem_settled`: always aborts `EDelayedExecutionRequired`. The
|
|
2152
|
+
* settled-redeem keeper allowlist on `ProtocolConfig` no longer gates any call.
|
|
1926
2153
|
*/
|
|
1927
2154
|
export function redeemSettledPermissionless(options: RedeemSettledPermissionlessOptions) {
|
|
1928
2155
|
const packageAddress =
|
|
@@ -1936,7 +2163,7 @@ export function redeemSettledPermissionless(options: RedeemSettledPermissionless
|
|
|
1936
2163
|
'0x2::accumulator::AccumulatorRoot',
|
|
1937
2164
|
'0x2::clock::Clock',
|
|
1938
2165
|
] satisfies (string | null)[];
|
|
1939
|
-
const parameterNames = ['
|
|
2166
|
+
const parameterNames = ['Market', 'AccountRegistry', 'Wrapper', 'Config', 'OrderId'];
|
|
1940
2167
|
return (tx: Transaction) =>
|
|
1941
2168
|
tx.moveCall({
|
|
1942
2169
|
package: packageAddress,
|
|
@@ -1945,7 +2172,7 @@ export function redeemSettledPermissionless(options: RedeemSettledPermissionless
|
|
|
1945
2172
|
arguments: normalizeMoveArguments(
|
|
1946
2173
|
{
|
|
1947
2174
|
...options.arguments,
|
|
1948
|
-
|
|
2175
|
+
Config: options.arguments?.Config ?? options.config?.protocolConfig,
|
|
1949
2176
|
},
|
|
1950
2177
|
argumentsTypes,
|
|
1951
2178
|
parameterNames,
|
|
@@ -2210,6 +2437,122 @@ export function admitMint<W extends BcsType<any>>(options: AdmitMintOptions<W>)
|
|
|
2210
2437
|
typeArguments: options.typeArguments,
|
|
2211
2438
|
});
|
|
2212
2439
|
}
|
|
2440
|
+
export interface AdmitMintWithBuilderArguments<W extends BcsType<any>> {
|
|
2441
|
+
W: RawTransactionArgument<W>;
|
|
2442
|
+
market: RawTransactionArgument<string>;
|
|
2443
|
+
config?: RawTransactionArgument<string>;
|
|
2444
|
+
account: TransactionArgument;
|
|
2445
|
+
propbookRegistry?: RawTransactionArgument<string>;
|
|
2446
|
+
pyth: RawTransactionArgument<string>;
|
|
2447
|
+
bsValues: RawTransactionArgument<string>;
|
|
2448
|
+
bsSvi: RawTransactionArgument<string>;
|
|
2449
|
+
builder: TransactionArgument;
|
|
2450
|
+
kind: RawTransactionArgument<number>;
|
|
2451
|
+
lowerTick: RawTransactionArgument<number | bigint>;
|
|
2452
|
+
higherTick: RawTransactionArgument<number | bigint>;
|
|
2453
|
+
quantity: RawTransactionArgument<number | bigint>;
|
|
2454
|
+
maxPremium: RawTransactionArgument<number | bigint>;
|
|
2455
|
+
minQuantity: RawTransactionArgument<number | bigint>;
|
|
2456
|
+
maxProbability: RawTransactionArgument<number | bigint>;
|
|
2457
|
+
budget: RawTransactionArgument<number | bigint>;
|
|
2458
|
+
orderFee: RawTransactionArgument<number | bigint>;
|
|
2459
|
+
sviMaxAgeMs: RawTransactionArgument<number | bigint>;
|
|
2460
|
+
channel: RawTransactionArgument<number>;
|
|
2461
|
+
tauMs: RawTransactionArgument<number | bigint>;
|
|
2462
|
+
deadlineMs: RawTransactionArgument<number | bigint>;
|
|
2463
|
+
}
|
|
2464
|
+
export interface AdmitMintWithBuilderOptions<W extends BcsType<any>> {
|
|
2465
|
+
package?: string;
|
|
2466
|
+
arguments: AdmitMintWithBuilderArguments<W>;
|
|
2467
|
+
config?: {
|
|
2468
|
+
protocolConfig: ConfigValue;
|
|
2469
|
+
oracleRegistry: ConfigValue;
|
|
2470
|
+
predictPackageId?: string;
|
|
2471
|
+
};
|
|
2472
|
+
typeArguments: [string];
|
|
2473
|
+
}
|
|
2474
|
+
/**
|
|
2475
|
+
* `admit_mint` for an order that may name a builder. `builder` is the code the
|
|
2476
|
+
* trade pays and its fee per contract, or none, which admits exactly as
|
|
2477
|
+
* `admit_mint` does. Admission caps the fee at `protocol_config::builder_fee_cap`,
|
|
2478
|
+
* records the code and the capped fee in the receipt, and prices the order's own
|
|
2479
|
+
* limits at the clock with that fee. The fill charges the recorded fee, so a later
|
|
2480
|
+
* cap change does not reach the order. Aborts as `admit_mint` does, and, for an
|
|
2481
|
+
* order that names a builder, `EBuilderFeeCutoverNotReached` until the version
|
|
2482
|
+
* watermark retires every version whose fill charges the legacy fee instead
|
|
2483
|
+
* (`constants::builder_fee_version!()`).
|
|
2484
|
+
*/
|
|
2485
|
+
export function admitMintWithBuilder<W extends BcsType<any>>(
|
|
2486
|
+
options: AdmitMintWithBuilderOptions<W>,
|
|
2487
|
+
) {
|
|
2488
|
+
const packageAddress =
|
|
2489
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
2490
|
+
const argumentsTypes = [
|
|
2491
|
+
`${options.typeArguments[0]}`,
|
|
2492
|
+
null,
|
|
2493
|
+
null,
|
|
2494
|
+
null,
|
|
2495
|
+
null,
|
|
2496
|
+
null,
|
|
2497
|
+
null,
|
|
2498
|
+
null,
|
|
2499
|
+
null,
|
|
2500
|
+
'u8',
|
|
2501
|
+
'u64',
|
|
2502
|
+
'u64',
|
|
2503
|
+
'u64',
|
|
2504
|
+
'u64',
|
|
2505
|
+
'u64',
|
|
2506
|
+
'u64',
|
|
2507
|
+
'u64',
|
|
2508
|
+
'u64',
|
|
2509
|
+
'u64',
|
|
2510
|
+
'u8',
|
|
2511
|
+
'u64',
|
|
2512
|
+
'u64',
|
|
2513
|
+
'0x2::clock::Clock',
|
|
2514
|
+
] satisfies (string | null)[];
|
|
2515
|
+
const parameterNames = [
|
|
2516
|
+
'W',
|
|
2517
|
+
'market',
|
|
2518
|
+
'config',
|
|
2519
|
+
'account',
|
|
2520
|
+
'propbookRegistry',
|
|
2521
|
+
'pyth',
|
|
2522
|
+
'bsValues',
|
|
2523
|
+
'bsSvi',
|
|
2524
|
+
'builder',
|
|
2525
|
+
'kind',
|
|
2526
|
+
'lowerTick',
|
|
2527
|
+
'higherTick',
|
|
2528
|
+
'quantity',
|
|
2529
|
+
'maxPremium',
|
|
2530
|
+
'minQuantity',
|
|
2531
|
+
'maxProbability',
|
|
2532
|
+
'budget',
|
|
2533
|
+
'orderFee',
|
|
2534
|
+
'sviMaxAgeMs',
|
|
2535
|
+
'channel',
|
|
2536
|
+
'tauMs',
|
|
2537
|
+
'deadlineMs',
|
|
2538
|
+
];
|
|
2539
|
+
return (tx: Transaction) =>
|
|
2540
|
+
tx.moveCall({
|
|
2541
|
+
package: packageAddress,
|
|
2542
|
+
module: 'expiry_market',
|
|
2543
|
+
function: 'admit_mint_with_builder',
|
|
2544
|
+
arguments: normalizeMoveArguments(
|
|
2545
|
+
{
|
|
2546
|
+
...options.arguments,
|
|
2547
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
2548
|
+
propbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry,
|
|
2549
|
+
},
|
|
2550
|
+
argumentsTypes,
|
|
2551
|
+
parameterNames,
|
|
2552
|
+
),
|
|
2553
|
+
typeArguments: options.typeArguments,
|
|
2554
|
+
});
|
|
2555
|
+
}
|
|
2213
2556
|
export interface AdmitSellArguments<W extends BcsType<any>> {
|
|
2214
2557
|
W: RawTransactionArgument<W>;
|
|
2215
2558
|
market: RawTransactionArgument<string>;
|
|
@@ -2242,7 +2585,7 @@ export interface AdmitSellOptions<W extends BcsType<any>> {
|
|
|
2242
2585
|
/**
|
|
2243
2586
|
* Admit an early sell of `close_quantity` of an open receipt's position: the
|
|
2244
2587
|
* receipt moves to the sell stage in place, with the sell's request, the account's
|
|
2245
|
-
* current owner and builder code, a fresh volatility snapshot, τ, the deadline,
|
|
2588
|
+
* current owner and no builder code, a fresh volatility snapshot, τ, the deadline,
|
|
2246
2589
|
* and no price. The companion escrows `order_fee` and owns the minimum-sell
|
|
2247
2590
|
* checks.
|
|
2248
2591
|
*
|
|
@@ -2316,6 +2659,109 @@ export function admitSell<W extends BcsType<any>>(options: AdmitSellOptions<W>)
|
|
|
2316
2659
|
typeArguments: options.typeArguments,
|
|
2317
2660
|
});
|
|
2318
2661
|
}
|
|
2662
|
+
export interface AdmitSellWithBuilderArguments<W extends BcsType<any>> {
|
|
2663
|
+
W: RawTransactionArgument<W>;
|
|
2664
|
+
market: RawTransactionArgument<string>;
|
|
2665
|
+
config?: RawTransactionArgument<string>;
|
|
2666
|
+
account: TransactionArgument;
|
|
2667
|
+
receipt: TransactionArgument;
|
|
2668
|
+
propbookRegistry?: RawTransactionArgument<string>;
|
|
2669
|
+
pyth: RawTransactionArgument<string>;
|
|
2670
|
+
bsValues: RawTransactionArgument<string>;
|
|
2671
|
+
bsSvi: RawTransactionArgument<string>;
|
|
2672
|
+
builder: TransactionArgument;
|
|
2673
|
+
closeQuantity: RawTransactionArgument<number | bigint>;
|
|
2674
|
+
minProbability: RawTransactionArgument<number | bigint>;
|
|
2675
|
+
minProceeds: RawTransactionArgument<number | bigint>;
|
|
2676
|
+
orderFee: RawTransactionArgument<number | bigint>;
|
|
2677
|
+
sviMaxAgeMs: RawTransactionArgument<number | bigint>;
|
|
2678
|
+
channel: RawTransactionArgument<number>;
|
|
2679
|
+
tauMs: RawTransactionArgument<number | bigint>;
|
|
2680
|
+
deadlineMs: RawTransactionArgument<number | bigint>;
|
|
2681
|
+
}
|
|
2682
|
+
export interface AdmitSellWithBuilderOptions<W extends BcsType<any>> {
|
|
2683
|
+
package?: string;
|
|
2684
|
+
arguments: AdmitSellWithBuilderArguments<W>;
|
|
2685
|
+
config?: {
|
|
2686
|
+
protocolConfig: ConfigValue;
|
|
2687
|
+
oracleRegistry: ConfigValue;
|
|
2688
|
+
predictPackageId?: string;
|
|
2689
|
+
};
|
|
2690
|
+
typeArguments: [string];
|
|
2691
|
+
}
|
|
2692
|
+
/**
|
|
2693
|
+
* `admit_sell` for a sell that may name a builder. `builder` is the code the sell
|
|
2694
|
+
* pays and its fee per contract, or none, which admits exactly as `admit_sell`
|
|
2695
|
+
* does. Admission caps the fee at `protocol_config::builder_fee_cap`, records the
|
|
2696
|
+
* code in the receipt in place of the mint's along with the capped fee, and prices
|
|
2697
|
+
* the close's floors at the clock with that fee. The fill charges the recorded
|
|
2698
|
+
* fee. Aborts as `admit_sell` does, and, for a sell that names a builder,
|
|
2699
|
+
* `EBuilderFeeCutoverNotReached` until the version watermark reaches
|
|
2700
|
+
* `constants::builder_fee_version!()`.
|
|
2701
|
+
*/
|
|
2702
|
+
export function admitSellWithBuilder<W extends BcsType<any>>(
|
|
2703
|
+
options: AdmitSellWithBuilderOptions<W>,
|
|
2704
|
+
) {
|
|
2705
|
+
const packageAddress =
|
|
2706
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
2707
|
+
const argumentsTypes = [
|
|
2708
|
+
`${options.typeArguments[0]}`,
|
|
2709
|
+
null,
|
|
2710
|
+
null,
|
|
2711
|
+
null,
|
|
2712
|
+
null,
|
|
2713
|
+
null,
|
|
2714
|
+
null,
|
|
2715
|
+
null,
|
|
2716
|
+
null,
|
|
2717
|
+
null,
|
|
2718
|
+
'u64',
|
|
2719
|
+
'u64',
|
|
2720
|
+
'u64',
|
|
2721
|
+
'u64',
|
|
2722
|
+
'u64',
|
|
2723
|
+
'u8',
|
|
2724
|
+
'u64',
|
|
2725
|
+
'u64',
|
|
2726
|
+
'0x2::clock::Clock',
|
|
2727
|
+
] satisfies (string | null)[];
|
|
2728
|
+
const parameterNames = [
|
|
2729
|
+
'W',
|
|
2730
|
+
'market',
|
|
2731
|
+
'config',
|
|
2732
|
+
'account',
|
|
2733
|
+
'receipt',
|
|
2734
|
+
'propbookRegistry',
|
|
2735
|
+
'pyth',
|
|
2736
|
+
'bsValues',
|
|
2737
|
+
'bsSvi',
|
|
2738
|
+
'builder',
|
|
2739
|
+
'closeQuantity',
|
|
2740
|
+
'minProbability',
|
|
2741
|
+
'minProceeds',
|
|
2742
|
+
'orderFee',
|
|
2743
|
+
'sviMaxAgeMs',
|
|
2744
|
+
'channel',
|
|
2745
|
+
'tauMs',
|
|
2746
|
+
'deadlineMs',
|
|
2747
|
+
];
|
|
2748
|
+
return (tx: Transaction) =>
|
|
2749
|
+
tx.moveCall({
|
|
2750
|
+
package: packageAddress,
|
|
2751
|
+
module: 'expiry_market',
|
|
2752
|
+
function: 'admit_sell_with_builder',
|
|
2753
|
+
arguments: normalizeMoveArguments(
|
|
2754
|
+
{
|
|
2755
|
+
...options.arguments,
|
|
2756
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
2757
|
+
propbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry,
|
|
2758
|
+
},
|
|
2759
|
+
argumentsTypes,
|
|
2760
|
+
parameterNames,
|
|
2761
|
+
),
|
|
2762
|
+
typeArguments: options.typeArguments,
|
|
2763
|
+
});
|
|
2764
|
+
}
|
|
2319
2765
|
export interface CommitArguments<W extends BcsType<any>> {
|
|
2320
2766
|
W: RawTransactionArgument<W>;
|
|
2321
2767
|
market: RawTransactionArgument<string>;
|