@mysten/deepbook-v3 2.9.2 → 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 +47 -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/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_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/queue.d.mts +3 -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/marginManager.d.mts.map +1 -1
- 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/marginTPSL.d.mts.map +1 -1
- 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 +1 -1
- 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
|
@@ -465,10 +465,44 @@ export function oldestUnfinishedTauMs(options: OldestUnfinishedTauMsOptions) {
|
|
|
465
465
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
466
466
|
});
|
|
467
467
|
}
|
|
468
|
+
export interface BuilderFeePerContractArguments {
|
|
469
|
+
queue: RawTransactionArgument<string>;
|
|
470
|
+
recordId: RawTransactionArgument<number | bigint>;
|
|
471
|
+
}
|
|
472
|
+
export interface BuilderFeePerContractOptions {
|
|
473
|
+
package?: string;
|
|
474
|
+
arguments:
|
|
475
|
+
| BuilderFeePerContractArguments
|
|
476
|
+
| [queue: RawTransactionArgument<string>, recordId: RawTransactionArgument<number | bigint>];
|
|
477
|
+
config?: {
|
|
478
|
+
predictOrdersPackageId?: string;
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Return the builder fee per contract `record_id`'s order pays at its fill, in
|
|
483
|
+
* FLOAT_SCALING of the $1 payout: the capped fee its receipt records, or `0` for a
|
|
484
|
+
* missing record, a record holding no receipt or an open one, and an order that
|
|
485
|
+
* names no builder. For SDK and devInspect reads of a waiting order.
|
|
486
|
+
*/
|
|
487
|
+
export function builderFeePerContract(options: BuilderFeePerContractOptions) {
|
|
488
|
+
const packageAddress =
|
|
489
|
+
options.package ??
|
|
490
|
+
options.config?.predictOrdersPackageId ??
|
|
491
|
+
'@local-pkg/deepbook_predict_orders';
|
|
492
|
+
const argumentsTypes = [null, 'u64'] satisfies (string | null)[];
|
|
493
|
+
const parameterNames = ['queue', 'recordId'];
|
|
494
|
+
return (tx: Transaction) =>
|
|
495
|
+
tx.moveCall({
|
|
496
|
+
package: packageAddress,
|
|
497
|
+
module: 'queue',
|
|
498
|
+
function: 'builder_fee_per_contract',
|
|
499
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
500
|
+
});
|
|
501
|
+
}
|
|
468
502
|
export interface QuoteRedeemOpenArguments {
|
|
469
503
|
queue: RawTransactionArgument<string>;
|
|
470
504
|
market: RawTransactionArgument<string>;
|
|
471
|
-
|
|
505
|
+
Wrapper: RawTransactionArgument<string>;
|
|
472
506
|
pricer: TransactionArgument;
|
|
473
507
|
recordId: RawTransactionArgument<number | bigint>;
|
|
474
508
|
closeQuantity: RawTransactionArgument<number | bigint>;
|
|
@@ -480,7 +514,7 @@ export interface QuoteRedeemOpenOptions {
|
|
|
480
514
|
| [
|
|
481
515
|
queue: RawTransactionArgument<string>,
|
|
482
516
|
market: RawTransactionArgument<string>,
|
|
483
|
-
|
|
517
|
+
Wrapper: RawTransactionArgument<string>,
|
|
484
518
|
pricer: TransactionArgument,
|
|
485
519
|
recordId: RawTransactionArgument<number | bigint>,
|
|
486
520
|
closeQuantity: RawTransactionArgument<number | bigint>,
|
|
@@ -491,12 +525,13 @@ export interface QuoteRedeemOpenOptions {
|
|
|
491
525
|
}
|
|
492
526
|
/**
|
|
493
527
|
* Quote an early sell of `close_quantity` from the Open record `record_id` at a
|
|
494
|
-
* live `Pricer
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
528
|
+
* live `Pricer` through Predict's `quote_close`: the close a queued sell fills,
|
|
529
|
+
* with the trading fee at the clock instead of a committed tick. No builder fee,
|
|
530
|
+
* matching `enqueue_redeem_open`; `quote_redeem_open_with_builder_fee` quotes a
|
|
531
|
+
* sell that names a builder. `proceeds` is before the order fee. Changes nothing.
|
|
532
|
+
* Aborts `ERecordNotOpen` for a missing or non-Open record, and otherwise as
|
|
533
|
+
* `quote_close` does. Does not check that the account owns the record. For SDK and
|
|
534
|
+
* devInspect pricing before `enqueue_redeem_open`.
|
|
500
535
|
*/
|
|
501
536
|
export function quoteRedeemOpen(options: QuoteRedeemOpenOptions) {
|
|
502
537
|
const packageAddress =
|
|
@@ -506,7 +541,7 @@ export function quoteRedeemOpen(options: QuoteRedeemOpenOptions) {
|
|
|
506
541
|
const argumentsTypes = [null, null, null, null, 'u64', 'u64', '0x2::clock::Clock'] satisfies (
|
|
507
542
|
string | null
|
|
508
543
|
)[];
|
|
509
|
-
const parameterNames = ['queue', 'market', '
|
|
544
|
+
const parameterNames = ['queue', 'market', 'Wrapper', 'pricer', 'recordId', 'closeQuantity'];
|
|
510
545
|
return (tx: Transaction) =>
|
|
511
546
|
tx.moveCall({
|
|
512
547
|
package: packageAddress,
|
|
@@ -515,6 +550,70 @@ export function quoteRedeemOpen(options: QuoteRedeemOpenOptions) {
|
|
|
515
550
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
516
551
|
});
|
|
517
552
|
}
|
|
553
|
+
export interface QuoteRedeemOpenWithBuilderFeeArguments {
|
|
554
|
+
queue: RawTransactionArgument<string>;
|
|
555
|
+
market: RawTransactionArgument<string>;
|
|
556
|
+
config?: RawTransactionArgument<string>;
|
|
557
|
+
pricer: TransactionArgument;
|
|
558
|
+
recordId: RawTransactionArgument<number | bigint>;
|
|
559
|
+
closeQuantity: RawTransactionArgument<number | bigint>;
|
|
560
|
+
builderFeePerContract: RawTransactionArgument<number | bigint>;
|
|
561
|
+
}
|
|
562
|
+
export interface QuoteRedeemOpenWithBuilderFeeOptions {
|
|
563
|
+
package?: string;
|
|
564
|
+
arguments: QuoteRedeemOpenWithBuilderFeeArguments;
|
|
565
|
+
config?: {
|
|
566
|
+
protocolConfig: ConfigValue;
|
|
567
|
+
predictOrdersPackageId?: string;
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* `quote_redeem_open` for a sell that names a builder, through Predict's
|
|
572
|
+
* `quote_close_with_builder_fee`: charges `builder_fee_per_contract`, in
|
|
573
|
+
* FLOAT_SCALING of the $1 payout, capped at `protocol_config::builder_fee_cap` and
|
|
574
|
+
* then at the redeem value left after the trading fee, as the fill charges it.
|
|
575
|
+
* Changes nothing and aborts like `quote_redeem_open`. For SDK and devInspect
|
|
576
|
+
* pricing before `enqueue_redeem_open_with_builder`.
|
|
577
|
+
*/
|
|
578
|
+
export function quoteRedeemOpenWithBuilderFee(options: QuoteRedeemOpenWithBuilderFeeOptions) {
|
|
579
|
+
const packageAddress =
|
|
580
|
+
options.package ??
|
|
581
|
+
options.config?.predictOrdersPackageId ??
|
|
582
|
+
'@local-pkg/deepbook_predict_orders';
|
|
583
|
+
const argumentsTypes = [
|
|
584
|
+
null,
|
|
585
|
+
null,
|
|
586
|
+
null,
|
|
587
|
+
null,
|
|
588
|
+
'u64',
|
|
589
|
+
'u64',
|
|
590
|
+
'u64',
|
|
591
|
+
'0x2::clock::Clock',
|
|
592
|
+
] satisfies (string | null)[];
|
|
593
|
+
const parameterNames = [
|
|
594
|
+
'queue',
|
|
595
|
+
'market',
|
|
596
|
+
'config',
|
|
597
|
+
'pricer',
|
|
598
|
+
'recordId',
|
|
599
|
+
'closeQuantity',
|
|
600
|
+
'builderFeePerContract',
|
|
601
|
+
];
|
|
602
|
+
return (tx: Transaction) =>
|
|
603
|
+
tx.moveCall({
|
|
604
|
+
package: packageAddress,
|
|
605
|
+
module: 'queue',
|
|
606
|
+
function: 'quote_redeem_open_with_builder_fee',
|
|
607
|
+
arguments: normalizeMoveArguments(
|
|
608
|
+
{
|
|
609
|
+
...options.arguments,
|
|
610
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
611
|
+
},
|
|
612
|
+
argumentsTypes,
|
|
613
|
+
parameterNames,
|
|
614
|
+
),
|
|
615
|
+
});
|
|
616
|
+
}
|
|
518
617
|
export interface CreateAndShareArguments {
|
|
519
618
|
registry?: RawTransactionArgument<string>;
|
|
520
619
|
desk?: RawTransactionArgument<string>;
|
|
@@ -659,6 +758,106 @@ export function enqueueExactQuantity(options: EnqueueExactQuantityOptions) {
|
|
|
659
758
|
),
|
|
660
759
|
});
|
|
661
760
|
}
|
|
761
|
+
export interface EnqueueExactQuantityWithBuilderArguments {
|
|
762
|
+
queue: RawTransactionArgument<string>;
|
|
763
|
+
market: RawTransactionArgument<string>;
|
|
764
|
+
wrapper: RawTransactionArgument<string>;
|
|
765
|
+
auth: TransactionArgument;
|
|
766
|
+
desk?: RawTransactionArgument<string>;
|
|
767
|
+
config?: RawTransactionArgument<string>;
|
|
768
|
+
propbookRegistry?: RawTransactionArgument<string>;
|
|
769
|
+
pyth: RawTransactionArgument<string>;
|
|
770
|
+
bsValues: RawTransactionArgument<string>;
|
|
771
|
+
bsSvi: RawTransactionArgument<string>;
|
|
772
|
+
code: RawTransactionArgument<string>;
|
|
773
|
+
builderFeePerContract: RawTransactionArgument<number | bigint>;
|
|
774
|
+
lowerTick: RawTransactionArgument<number | bigint>;
|
|
775
|
+
higherTick: RawTransactionArgument<number | bigint>;
|
|
776
|
+
quantity: RawTransactionArgument<number | bigint>;
|
|
777
|
+
maxCost: RawTransactionArgument<number | bigint>;
|
|
778
|
+
maxProbability: RawTransactionArgument<number | bigint>;
|
|
779
|
+
}
|
|
780
|
+
export interface EnqueueExactQuantityWithBuilderOptions {
|
|
781
|
+
package?: string;
|
|
782
|
+
arguments: EnqueueExactQuantityWithBuilderArguments;
|
|
783
|
+
config?: {
|
|
784
|
+
orderDesk: ConfigValue;
|
|
785
|
+
protocolConfig: ConfigValue;
|
|
786
|
+
oracleRegistry: ConfigValue;
|
|
787
|
+
predictOrdersPackageId?: string;
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* `enqueue_exact_quantity` for an order that names a builder: `code` is the
|
|
792
|
+
* builder code the trade pays and `builder_fee_per_contract` its fee per contract,
|
|
793
|
+
* in FLOAT_SCALING of the $1 payout. Predict caps the fee at
|
|
794
|
+
* `protocol_config::builder_fee_cap`, records it in the order's receipt, and
|
|
795
|
+
* prices the order's limits with it, and the fill pays `quantity * fee`, rounded
|
|
796
|
+
* down, to the code. Refuses orders like `enqueue_exact_quantity`. Returns the new
|
|
797
|
+
* record ID.
|
|
798
|
+
*/
|
|
799
|
+
export function enqueueExactQuantityWithBuilder(options: EnqueueExactQuantityWithBuilderOptions) {
|
|
800
|
+
const packageAddress =
|
|
801
|
+
options.package ??
|
|
802
|
+
options.config?.predictOrdersPackageId ??
|
|
803
|
+
'@local-pkg/deepbook_predict_orders';
|
|
804
|
+
const argumentsTypes = [
|
|
805
|
+
null,
|
|
806
|
+
null,
|
|
807
|
+
null,
|
|
808
|
+
null,
|
|
809
|
+
null,
|
|
810
|
+
null,
|
|
811
|
+
null,
|
|
812
|
+
null,
|
|
813
|
+
null,
|
|
814
|
+
null,
|
|
815
|
+
null,
|
|
816
|
+
'u64',
|
|
817
|
+
'u64',
|
|
818
|
+
'u64',
|
|
819
|
+
'u64',
|
|
820
|
+
'u64',
|
|
821
|
+
'u64',
|
|
822
|
+
'0x2::accumulator::AccumulatorRoot',
|
|
823
|
+
'0x2::clock::Clock',
|
|
824
|
+
] satisfies (string | null)[];
|
|
825
|
+
const parameterNames = [
|
|
826
|
+
'queue',
|
|
827
|
+
'market',
|
|
828
|
+
'wrapper',
|
|
829
|
+
'auth',
|
|
830
|
+
'desk',
|
|
831
|
+
'config',
|
|
832
|
+
'propbookRegistry',
|
|
833
|
+
'pyth',
|
|
834
|
+
'bsValues',
|
|
835
|
+
'bsSvi',
|
|
836
|
+
'code',
|
|
837
|
+
'builderFeePerContract',
|
|
838
|
+
'lowerTick',
|
|
839
|
+
'higherTick',
|
|
840
|
+
'quantity',
|
|
841
|
+
'maxCost',
|
|
842
|
+
'maxProbability',
|
|
843
|
+
];
|
|
844
|
+
return (tx: Transaction) =>
|
|
845
|
+
tx.moveCall({
|
|
846
|
+
package: packageAddress,
|
|
847
|
+
module: 'queue',
|
|
848
|
+
function: 'enqueue_exact_quantity_with_builder',
|
|
849
|
+
arguments: normalizeMoveArguments(
|
|
850
|
+
{
|
|
851
|
+
...options.arguments,
|
|
852
|
+
desk: options.arguments?.desk ?? options.config?.orderDesk,
|
|
853
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
854
|
+
propbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry,
|
|
855
|
+
},
|
|
856
|
+
argumentsTypes,
|
|
857
|
+
parameterNames,
|
|
858
|
+
),
|
|
859
|
+
});
|
|
860
|
+
}
|
|
662
861
|
export interface EnqueueExactAmountArguments {
|
|
663
862
|
queue: RawTransactionArgument<string>;
|
|
664
863
|
market: RawTransactionArgument<string>;
|
|
@@ -750,6 +949,102 @@ export function enqueueExactAmount(options: EnqueueExactAmountOptions) {
|
|
|
750
949
|
),
|
|
751
950
|
});
|
|
752
951
|
}
|
|
952
|
+
export interface EnqueueExactAmountWithBuilderArguments {
|
|
953
|
+
queue: RawTransactionArgument<string>;
|
|
954
|
+
market: RawTransactionArgument<string>;
|
|
955
|
+
wrapper: RawTransactionArgument<string>;
|
|
956
|
+
auth: TransactionArgument;
|
|
957
|
+
desk?: RawTransactionArgument<string>;
|
|
958
|
+
config?: RawTransactionArgument<string>;
|
|
959
|
+
propbookRegistry?: RawTransactionArgument<string>;
|
|
960
|
+
pyth: RawTransactionArgument<string>;
|
|
961
|
+
bsValues: RawTransactionArgument<string>;
|
|
962
|
+
bsSvi: RawTransactionArgument<string>;
|
|
963
|
+
code: RawTransactionArgument<string>;
|
|
964
|
+
builderFeePerContract: RawTransactionArgument<number | bigint>;
|
|
965
|
+
lowerTick: RawTransactionArgument<number | bigint>;
|
|
966
|
+
higherTick: RawTransactionArgument<number | bigint>;
|
|
967
|
+
maxPremium: RawTransactionArgument<number | bigint>;
|
|
968
|
+
minQuantity: RawTransactionArgument<number | bigint>;
|
|
969
|
+
maxCost: RawTransactionArgument<number | bigint>;
|
|
970
|
+
}
|
|
971
|
+
export interface EnqueueExactAmountWithBuilderOptions {
|
|
972
|
+
package?: string;
|
|
973
|
+
arguments: EnqueueExactAmountWithBuilderArguments;
|
|
974
|
+
config?: {
|
|
975
|
+
orderDesk: ConfigValue;
|
|
976
|
+
protocolConfig: ConfigValue;
|
|
977
|
+
oracleRegistry: ConfigValue;
|
|
978
|
+
predictOrdersPackageId?: string;
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* `enqueue_exact_amount` for an order that names a builder, charging the capped
|
|
983
|
+
* `builder_fee_per_contract` to `code` like `enqueue_exact_quantity_with_builder`.
|
|
984
|
+
* The fee is inside the `max_cost` withdrawal cap. Returns the new record ID.
|
|
985
|
+
*/
|
|
986
|
+
export function enqueueExactAmountWithBuilder(options: EnqueueExactAmountWithBuilderOptions) {
|
|
987
|
+
const packageAddress =
|
|
988
|
+
options.package ??
|
|
989
|
+
options.config?.predictOrdersPackageId ??
|
|
990
|
+
'@local-pkg/deepbook_predict_orders';
|
|
991
|
+
const argumentsTypes = [
|
|
992
|
+
null,
|
|
993
|
+
null,
|
|
994
|
+
null,
|
|
995
|
+
null,
|
|
996
|
+
null,
|
|
997
|
+
null,
|
|
998
|
+
null,
|
|
999
|
+
null,
|
|
1000
|
+
null,
|
|
1001
|
+
null,
|
|
1002
|
+
null,
|
|
1003
|
+
'u64',
|
|
1004
|
+
'u64',
|
|
1005
|
+
'u64',
|
|
1006
|
+
'u64',
|
|
1007
|
+
'u64',
|
|
1008
|
+
'u64',
|
|
1009
|
+
'0x2::accumulator::AccumulatorRoot',
|
|
1010
|
+
'0x2::clock::Clock',
|
|
1011
|
+
] satisfies (string | null)[];
|
|
1012
|
+
const parameterNames = [
|
|
1013
|
+
'queue',
|
|
1014
|
+
'market',
|
|
1015
|
+
'wrapper',
|
|
1016
|
+
'auth',
|
|
1017
|
+
'desk',
|
|
1018
|
+
'config',
|
|
1019
|
+
'propbookRegistry',
|
|
1020
|
+
'pyth',
|
|
1021
|
+
'bsValues',
|
|
1022
|
+
'bsSvi',
|
|
1023
|
+
'code',
|
|
1024
|
+
'builderFeePerContract',
|
|
1025
|
+
'lowerTick',
|
|
1026
|
+
'higherTick',
|
|
1027
|
+
'maxPremium',
|
|
1028
|
+
'minQuantity',
|
|
1029
|
+
'maxCost',
|
|
1030
|
+
];
|
|
1031
|
+
return (tx: Transaction) =>
|
|
1032
|
+
tx.moveCall({
|
|
1033
|
+
package: packageAddress,
|
|
1034
|
+
module: 'queue',
|
|
1035
|
+
function: 'enqueue_exact_amount_with_builder',
|
|
1036
|
+
arguments: normalizeMoveArguments(
|
|
1037
|
+
{
|
|
1038
|
+
...options.arguments,
|
|
1039
|
+
desk: options.arguments?.desk ?? options.config?.orderDesk,
|
|
1040
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
1041
|
+
propbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry,
|
|
1042
|
+
},
|
|
1043
|
+
argumentsTypes,
|
|
1044
|
+
parameterNames,
|
|
1045
|
+
),
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
753
1048
|
export interface EnqueueExactCostArguments {
|
|
754
1049
|
queue: RawTransactionArgument<string>;
|
|
755
1050
|
market: RawTransactionArgument<string>;
|
|
@@ -839,6 +1134,100 @@ export function enqueueExactCost(options: EnqueueExactCostOptions) {
|
|
|
839
1134
|
),
|
|
840
1135
|
});
|
|
841
1136
|
}
|
|
1137
|
+
export interface EnqueueExactCostWithBuilderArguments {
|
|
1138
|
+
queue: RawTransactionArgument<string>;
|
|
1139
|
+
market: RawTransactionArgument<string>;
|
|
1140
|
+
wrapper: RawTransactionArgument<string>;
|
|
1141
|
+
auth: TransactionArgument;
|
|
1142
|
+
desk?: RawTransactionArgument<string>;
|
|
1143
|
+
config?: RawTransactionArgument<string>;
|
|
1144
|
+
propbookRegistry?: RawTransactionArgument<string>;
|
|
1145
|
+
pyth: RawTransactionArgument<string>;
|
|
1146
|
+
bsValues: RawTransactionArgument<string>;
|
|
1147
|
+
bsSvi: RawTransactionArgument<string>;
|
|
1148
|
+
code: RawTransactionArgument<string>;
|
|
1149
|
+
builderFeePerContract: RawTransactionArgument<number | bigint>;
|
|
1150
|
+
lowerTick: RawTransactionArgument<number | bigint>;
|
|
1151
|
+
higherTick: RawTransactionArgument<number | bigint>;
|
|
1152
|
+
maxCost: RawTransactionArgument<number | bigint>;
|
|
1153
|
+
minQuantity: RawTransactionArgument<number | bigint>;
|
|
1154
|
+
}
|
|
1155
|
+
export interface EnqueueExactCostWithBuilderOptions {
|
|
1156
|
+
package?: string;
|
|
1157
|
+
arguments: EnqueueExactCostWithBuilderArguments;
|
|
1158
|
+
config?: {
|
|
1159
|
+
orderDesk: ConfigValue;
|
|
1160
|
+
protocolConfig: ConfigValue;
|
|
1161
|
+
oracleRegistry: ConfigValue;
|
|
1162
|
+
predictOrdersPackageId?: string;
|
|
1163
|
+
};
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* `enqueue_exact_cost` for an order that names a builder, charging the capped
|
|
1167
|
+
* `builder_fee_per_contract` to `code` like `enqueue_exact_quantity_with_builder`.
|
|
1168
|
+
* The fill sizes the order so the fee fits inside `max_cost`. Returns the new
|
|
1169
|
+
* record ID.
|
|
1170
|
+
*/
|
|
1171
|
+
export function enqueueExactCostWithBuilder(options: EnqueueExactCostWithBuilderOptions) {
|
|
1172
|
+
const packageAddress =
|
|
1173
|
+
options.package ??
|
|
1174
|
+
options.config?.predictOrdersPackageId ??
|
|
1175
|
+
'@local-pkg/deepbook_predict_orders';
|
|
1176
|
+
const argumentsTypes = [
|
|
1177
|
+
null,
|
|
1178
|
+
null,
|
|
1179
|
+
null,
|
|
1180
|
+
null,
|
|
1181
|
+
null,
|
|
1182
|
+
null,
|
|
1183
|
+
null,
|
|
1184
|
+
null,
|
|
1185
|
+
null,
|
|
1186
|
+
null,
|
|
1187
|
+
null,
|
|
1188
|
+
'u64',
|
|
1189
|
+
'u64',
|
|
1190
|
+
'u64',
|
|
1191
|
+
'u64',
|
|
1192
|
+
'u64',
|
|
1193
|
+
'0x2::accumulator::AccumulatorRoot',
|
|
1194
|
+
'0x2::clock::Clock',
|
|
1195
|
+
] satisfies (string | null)[];
|
|
1196
|
+
const parameterNames = [
|
|
1197
|
+
'queue',
|
|
1198
|
+
'market',
|
|
1199
|
+
'wrapper',
|
|
1200
|
+
'auth',
|
|
1201
|
+
'desk',
|
|
1202
|
+
'config',
|
|
1203
|
+
'propbookRegistry',
|
|
1204
|
+
'pyth',
|
|
1205
|
+
'bsValues',
|
|
1206
|
+
'bsSvi',
|
|
1207
|
+
'code',
|
|
1208
|
+
'builderFeePerContract',
|
|
1209
|
+
'lowerTick',
|
|
1210
|
+
'higherTick',
|
|
1211
|
+
'maxCost',
|
|
1212
|
+
'minQuantity',
|
|
1213
|
+
];
|
|
1214
|
+
return (tx: Transaction) =>
|
|
1215
|
+
tx.moveCall({
|
|
1216
|
+
package: packageAddress,
|
|
1217
|
+
module: 'queue',
|
|
1218
|
+
function: 'enqueue_exact_cost_with_builder',
|
|
1219
|
+
arguments: normalizeMoveArguments(
|
|
1220
|
+
{
|
|
1221
|
+
...options.arguments,
|
|
1222
|
+
desk: options.arguments?.desk ?? options.config?.orderDesk,
|
|
1223
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
1224
|
+
propbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry,
|
|
1225
|
+
},
|
|
1226
|
+
argumentsTypes,
|
|
1227
|
+
parameterNames,
|
|
1228
|
+
),
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
842
1231
|
export interface EnqueueRedeemOpenArguments {
|
|
843
1232
|
queue: RawTransactionArgument<string>;
|
|
844
1233
|
market: RawTransactionArgument<string>;
|
|
@@ -937,6 +1326,103 @@ export function enqueueRedeemOpen(options: EnqueueRedeemOpenOptions) {
|
|
|
937
1326
|
),
|
|
938
1327
|
});
|
|
939
1328
|
}
|
|
1329
|
+
export interface EnqueueRedeemOpenWithBuilderArguments {
|
|
1330
|
+
queue: RawTransactionArgument<string>;
|
|
1331
|
+
market: RawTransactionArgument<string>;
|
|
1332
|
+
wrapper: RawTransactionArgument<string>;
|
|
1333
|
+
auth: TransactionArgument;
|
|
1334
|
+
desk?: RawTransactionArgument<string>;
|
|
1335
|
+
config?: RawTransactionArgument<string>;
|
|
1336
|
+
propbookRegistry?: RawTransactionArgument<string>;
|
|
1337
|
+
pyth: RawTransactionArgument<string>;
|
|
1338
|
+
bsValues: RawTransactionArgument<string>;
|
|
1339
|
+
bsSvi: RawTransactionArgument<string>;
|
|
1340
|
+
code: RawTransactionArgument<string>;
|
|
1341
|
+
builderFeePerContract: RawTransactionArgument<number | bigint>;
|
|
1342
|
+
recordId: RawTransactionArgument<number | bigint>;
|
|
1343
|
+
closeQuantity: RawTransactionArgument<number | bigint>;
|
|
1344
|
+
minProbability: RawTransactionArgument<number | bigint>;
|
|
1345
|
+
minProceeds: RawTransactionArgument<number | bigint>;
|
|
1346
|
+
}
|
|
1347
|
+
export interface EnqueueRedeemOpenWithBuilderOptions {
|
|
1348
|
+
package?: string;
|
|
1349
|
+
arguments: EnqueueRedeemOpenWithBuilderArguments;
|
|
1350
|
+
config?: {
|
|
1351
|
+
orderDesk: ConfigValue;
|
|
1352
|
+
protocolConfig: ConfigValue;
|
|
1353
|
+
oracleRegistry: ConfigValue;
|
|
1354
|
+
predictOrdersPackageId?: string;
|
|
1355
|
+
};
|
|
1356
|
+
}
|
|
1357
|
+
/**
|
|
1358
|
+
* `enqueue_redeem_open` for a sell that names a builder: `code` is the builder
|
|
1359
|
+
* code the sell pays and `builder_fee_per_contract` its fee per contract, in
|
|
1360
|
+
* FLOAT_SCALING of the $1 payout. Predict caps the fee at
|
|
1361
|
+
* `protocol_config::builder_fee_cap`, records it in the order's receipt, and
|
|
1362
|
+
* checks `min_proceeds` with it, and the fill pays `close_quantity * fee`, rounded
|
|
1363
|
+
* down, to the code, capped at the redeem value left after the trading fee.
|
|
1364
|
+
* Refuses sells like `enqueue_redeem_open`. Returns the new record ID.
|
|
1365
|
+
*/
|
|
1366
|
+
export function enqueueRedeemOpenWithBuilder(options: EnqueueRedeemOpenWithBuilderOptions) {
|
|
1367
|
+
const packageAddress =
|
|
1368
|
+
options.package ??
|
|
1369
|
+
options.config?.predictOrdersPackageId ??
|
|
1370
|
+
'@local-pkg/deepbook_predict_orders';
|
|
1371
|
+
const argumentsTypes = [
|
|
1372
|
+
null,
|
|
1373
|
+
null,
|
|
1374
|
+
null,
|
|
1375
|
+
null,
|
|
1376
|
+
null,
|
|
1377
|
+
null,
|
|
1378
|
+
null,
|
|
1379
|
+
null,
|
|
1380
|
+
null,
|
|
1381
|
+
null,
|
|
1382
|
+
null,
|
|
1383
|
+
'u64',
|
|
1384
|
+
'u64',
|
|
1385
|
+
'u64',
|
|
1386
|
+
'u64',
|
|
1387
|
+
'u64',
|
|
1388
|
+
'0x2::accumulator::AccumulatorRoot',
|
|
1389
|
+
'0x2::clock::Clock',
|
|
1390
|
+
] satisfies (string | null)[];
|
|
1391
|
+
const parameterNames = [
|
|
1392
|
+
'queue',
|
|
1393
|
+
'market',
|
|
1394
|
+
'wrapper',
|
|
1395
|
+
'auth',
|
|
1396
|
+
'desk',
|
|
1397
|
+
'config',
|
|
1398
|
+
'propbookRegistry',
|
|
1399
|
+
'pyth',
|
|
1400
|
+
'bsValues',
|
|
1401
|
+
'bsSvi',
|
|
1402
|
+
'code',
|
|
1403
|
+
'builderFeePerContract',
|
|
1404
|
+
'recordId',
|
|
1405
|
+
'closeQuantity',
|
|
1406
|
+
'minProbability',
|
|
1407
|
+
'minProceeds',
|
|
1408
|
+
];
|
|
1409
|
+
return (tx: Transaction) =>
|
|
1410
|
+
tx.moveCall({
|
|
1411
|
+
package: packageAddress,
|
|
1412
|
+
module: 'queue',
|
|
1413
|
+
function: 'enqueue_redeem_open_with_builder',
|
|
1414
|
+
arguments: normalizeMoveArguments(
|
|
1415
|
+
{
|
|
1416
|
+
...options.arguments,
|
|
1417
|
+
desk: options.arguments?.desk ?? options.config?.orderDesk,
|
|
1418
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
1419
|
+
propbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry,
|
|
1420
|
+
},
|
|
1421
|
+
argumentsTypes,
|
|
1422
|
+
parameterNames,
|
|
1423
|
+
),
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
940
1426
|
export interface CommitArguments {
|
|
941
1427
|
queue: RawTransactionArgument<string>;
|
|
942
1428
|
market: RawTransactionArgument<string>;
|