@parchment-trade/sdk 0.0.0-stage → 1.0.1
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/LICENSE +202 -0
- package/README.md +193 -2
- package/REFERENCE.md +338 -0
- package/SECURITY.md +25 -0
- package/dist/general/providers/index.d.ts +2 -0
- package/dist/general/providers/index.js +2 -0
- package/dist/general/providers/parchment.d.ts +1 -0
- package/dist/general/providers/parchment.js +1 -0
- package/dist/general/providers/parchmentSdk.d.ts +23 -0
- package/dist/general/providers/parchmentSdk.js +11 -0
- package/dist/general/types/configTypes.d.ts +62 -0
- package/dist/general/types/configTypes.js +1 -0
- package/dist/general/types/index.d.ts +1 -0
- package/dist/general/types/index.js +1 -0
- package/dist/general/utils/address.d.ts +49 -0
- package/dist/general/utils/address.js +110 -0
- package/dist/general/utils/caller.d.ts +58 -0
- package/dist/general/utils/caller.js +182 -0
- package/dist/general/utils/errors.d.ts +16 -0
- package/dist/general/utils/errors.js +26 -0
- package/dist/general/utils/index.d.ts +4 -0
- package/dist/general/utils/index.js +4 -0
- package/dist/general/utils/jsBigInt.d.ts +26 -0
- package/dist/general/utils/jsBigInt.js +74 -0
- package/dist/general/utils/txShape.d.ts +8 -0
- package/dist/general/utils/txShape.js +39 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/packages/index.d.ts +11 -0
- package/dist/packages/index.js +5 -0
- package/dist/packages/parchment/abortCodes.d.ts +196 -0
- package/dist/packages/parchment/abortCodes.js +522 -0
- package/dist/packages/parchment/batchClose.d.ts +268 -0
- package/dist/packages/parchment/batchClose.js +524 -0
- package/dist/packages/parchment/eventGuard.d.ts +106 -0
- package/dist/packages/parchment/eventGuard.js +119 -0
- package/dist/packages/parchment/gameCounterEvents.d.ts +59 -0
- package/dist/packages/parchment/gameCounterEvents.js +56 -0
- package/dist/packages/parchment/index.d.ts +52 -0
- package/dist/packages/parchment/index.js +30 -0
- package/dist/packages/parchment/liquidationCredit.d.ts +28 -0
- package/dist/packages/parchment/liquidationCredit.js +25 -0
- package/dist/packages/parchment/lockedMintEvents.d.ts +42 -0
- package/dist/packages/parchment/lockedMintEvents.js +46 -0
- package/dist/packages/parchment/monitoring.d.ts +369 -0
- package/dist/packages/parchment/monitoring.js +259 -0
- package/dist/packages/parchment/notes.d.ts +6 -0
- package/dist/packages/parchment/notes.js +1 -0
- package/dist/packages/parchment/onboarding.d.ts +50 -0
- package/dist/packages/parchment/onboarding.js +48 -0
- package/dist/packages/parchment/orderEffects.d.ts +207 -0
- package/dist/packages/parchment/orderEffects.js +268 -0
- package/dist/packages/parchment/orderParams.d.ts +72 -0
- package/dist/packages/parchment/orderParams.js +71 -0
- package/dist/packages/parchment/packageIds.d.ts +53 -0
- package/dist/packages/parchment/packageIds.js +149 -0
- package/dist/packages/parchment/parchment.d.ts +442 -0
- package/dist/packages/parchment/parchment.js +975 -0
- package/dist/packages/parchment/parchmentAccount.d.ts +189 -0
- package/dist/packages/parchment/parchmentAccount.js +273 -0
- package/dist/packages/parchment/parchmentMarket.d.ts +58 -0
- package/dist/packages/parchment/parchmentMarket.js +86 -0
- package/dist/packages/parchment/parchmentTypes.d.ts +2031 -0
- package/dist/packages/parchment/parchmentTypes.js +65 -0
- package/dist/packages/parchment/publicInts.d.ts +45 -0
- package/dist/packages/parchment/publicInts.js +383 -0
- package/dist/packages/parchment/reconcileEvents.d.ts +24 -0
- package/dist/packages/parchment/reconcileEvents.js +30 -0
- package/dist/packages/parchment/retainedFee.d.ts +43 -0
- package/dist/packages/parchment/retainedFee.js +68 -0
- package/dist/packages/parchment/sessionClose.d.ts +68 -0
- package/dist/packages/parchment/sessionClose.js +50 -0
- package/dist/packages/parchment/sessionKey.d.ts +78 -0
- package/dist/packages/parchment/sessionKey.js +154 -0
- package/dist/packages/parchment/slippage.d.ts +23 -0
- package/dist/packages/parchment/slippage.js +27 -0
- package/dist/packages/parchment/sponsor.d.ts +39 -0
- package/dist/packages/parchment/sponsor.js +48 -0
- package/dist/packages/parchment/stakingCalls.d.ts +33 -0
- package/dist/packages/parchment/stakingCalls.js +21 -0
- package/dist/packages/parchment/stakingEvents.d.ts +53 -0
- package/dist/packages/parchment/stakingEvents.js +71 -0
- package/dist/packages/parchment/triggerCalls.d.ts +46 -0
- package/dist/packages/parchment/triggerCalls.js +36 -0
- package/dist/packages/parchment/triggerEvents.d.ts +22 -0
- package/dist/packages/parchment/triggerEvents.js +33 -0
- package/dist/packages/parchment/triggers.d.ts +113 -0
- package/dist/packages/parchment/triggers.js +183 -0
- package/dist/packages/parchment/txBodies.d.ts +111 -0
- package/dist/packages/parchment/txBodies.js +683 -0
- package/dist/packages/parchment/txIntent.d.ts +99 -0
- package/dist/packages/parchment/txIntent.js +611 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.js +1 -0
- package/package.json +58 -4
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
|
+
import type { ParchmentTxRequest } from "./parchmentTypes.js";
|
|
3
|
+
import { type ParchmentTxTrustSetting } from "./txIntent.js";
|
|
4
|
+
/**
|
|
5
|
+
* Sui protocol limits a batch must stay within (protocol config, mainnet v137:
|
|
6
|
+
* `max_programmable_tx_commands`, `max_tx_size_bytes`, `max_num_event_emit`,
|
|
7
|
+
* `max_num_new_move_object_ids`, `max_arguments`).
|
|
8
|
+
*/
|
|
9
|
+
export declare const SUI_TX_LIMITS: {
|
|
10
|
+
readonly commands: 1024;
|
|
11
|
+
readonly txBytes: number;
|
|
12
|
+
readonly events: 1024;
|
|
13
|
+
readonly newObjectIds: 2048;
|
|
14
|
+
readonly argumentsPerCommand: 512;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* What a batch may use. Commands and arguments are measured exactly on the tx as it resolves
|
|
18
|
+
* (wallet coin included), so they get the full limit. The kind's bytes get 3/4: the rest covers what
|
|
19
|
+
* is added after the kind (the gas payment, up to `max_gas_payment_objects` 256 refs ~19 KiB, the
|
|
20
|
+
* TransactionData envelope, the signatures: zkLogin / multisig, a few KiB), all counted by
|
|
21
|
+
* `max_tx_size_bytes`. Events and new ids only show at execution: they are upper bounds counted
|
|
22
|
+
* from the contracts (`LEG_EXECUTION`) and get 3/4, the one safety margin on those counts. The game
|
|
23
|
+
* progression events ({@link playerProgressionEvents}) are an exact maximum from the contract
|
|
24
|
+
* constants, so they take their share of Sui's 1,024 directly and the 3/4 applies to the rest:
|
|
25
|
+
* leg events <= 768 x (1,024 - progression) / 1,024.
|
|
26
|
+
*/
|
|
27
|
+
export declare const CLOSE_BATCH_BUDGET: {
|
|
28
|
+
readonly commands: 1024;
|
|
29
|
+
readonly txBytes: number;
|
|
30
|
+
readonly events: 768;
|
|
31
|
+
readonly newObjectIds: 1536;
|
|
32
|
+
readonly argumentsPerCommand: 512;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* What the gas sponsor takes in one session-key transaction (the sponsor service:
|
|
36
|
+
* the earlier fixed 16 is gone):
|
|
37
|
+
* - a Close All of `request_close_as_delegate` legs only: one command and at most
|
|
38
|
+
* {@link SPONSOR_BATCH_BUDGET.inputsPerTrade} distinct inputs per close (never fewer than
|
|
39
|
+
* {@link SPONSOR_BATCH_BUDGET.inputs} allowed), no fixed count. What bounds it is gas: the
|
|
40
|
+
* simulated cost must fit `sponsor.max-gas-budget` (50M MIST) per close, at most 1 SUI per tx. One
|
|
41
|
+
* close simulates at about 19.5M MIST gross on testnet, so 1 SUI holds about 51; `trades` takes 32
|
|
42
|
+
* (~1.6x headroom on that measure). A sponsor that refuses on gas (`gas_budget_exceeded`) is met
|
|
43
|
+
* with a smaller `BatchCloseOptions.maxTrades`.
|
|
44
|
+
* - a retired Close All (sponsor `max-retired-closes-per-tx`, default 24, since
|
|
45
|
+
* h/sponsor-retired-batch): up to {@link SPONSOR_BATCH_BUDGET.retiredTrades}
|
|
46
|
+
* `close_retired_as_delegate` legs, each with its quote, `begin_price`, mint and transfer, and one
|
|
47
|
+
* storage push per market (`update_price_feed` once per storage and feed: {@link batchCloseTx}
|
|
48
|
+
* drops a sponsored leg's push its market already had), at most
|
|
49
|
+
* {@link SPONSOR_BATCH_BUDGET.retiredCommandsPerTrade} commands and
|
|
50
|
+
* max({@link SPONSOR_BATCH_BUDGET.inputs}, {@link SPONSOR_BATCH_BUDGET.retiredInputsPerTrade} per
|
|
51
|
+
* close) inputs. Its gas ceiling is 0.2 SUI per close, at most 1 SUI: a refusal on gas
|
|
52
|
+
* (`gas_budget_exceeded`) is met with a smaller `BatchCloseOptions.maxTrades`, which bounds these
|
|
53
|
+
* too. A sponsor before that change takes one retired close per tx (`too_many_trades`,
|
|
54
|
+
* `disallowed_command`): `maxTrades: 1` is that shape.
|
|
55
|
+
* The two never share a tx (`mixed_trades`). Applied on top of {@link CLOSE_BATCH_BUDGET} when
|
|
56
|
+
* {@link BatchCloseOptions.sponsored}.
|
|
57
|
+
*/
|
|
58
|
+
export declare const SPONSOR_BATCH_BUDGET: {
|
|
59
|
+
readonly trades: 32;
|
|
60
|
+
readonly inputs: 64;
|
|
61
|
+
readonly inputsPerTrade: 7;
|
|
62
|
+
readonly oneTradeCommands: 8;
|
|
63
|
+
readonly retiredTrades: 24;
|
|
64
|
+
readonly retiredCommandsPerTrade: 6;
|
|
65
|
+
readonly retiredInputsPerTrade: 16;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Registry sizes the game's once-per-player events scale with, at the contract maxima
|
|
69
|
+
* (`parchment_base::constants`: `max_game_defs` 128 achievements / quests / cosmetics,
|
|
70
|
+
* `max_tier_thresholds` 32). There is no unopened-crate cap since the batch-open contract.
|
|
71
|
+
*/
|
|
72
|
+
export declare const GAME_REGISTRY_MAXIMA: {
|
|
73
|
+
readonly achievements: 128;
|
|
74
|
+
readonly quests: 128;
|
|
75
|
+
readonly cosmetics: 128;
|
|
76
|
+
readonly tierThresholds: 32;
|
|
77
|
+
};
|
|
78
|
+
/** Live (or maximum) registry sizes for {@link playerProgressionEvents}; see {@link gameEventLimitsFromDefinitions}. */
|
|
79
|
+
export type GameEventLimits = {
|
|
80
|
+
[K in keyof typeof GAME_REGISTRY_MAXIMA]: number;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Registry sizes from `getGameDefinitions()`. Tier thresholds are not in that response: they stay
|
|
84
|
+
* at the contract maximum unless given.
|
|
85
|
+
*/
|
|
86
|
+
export declare function gameEventLimitsFromDefinitions(definitions: {
|
|
87
|
+
achievements: readonly unknown[];
|
|
88
|
+
quests: readonly unknown[];
|
|
89
|
+
cosmetics: readonly unknown[];
|
|
90
|
+
}, config?: Partial<Pick<GameEventLimits, "tierThresholds">>): GameEventLimits;
|
|
91
|
+
/**
|
|
92
|
+
* Most events one player's progression can emit in one tx, whatever the number of their closes
|
|
93
|
+
* (`game_book::settle` and `apply_xp`; each definition fires once per player): per achievement
|
|
94
|
+
* RewardMinted + AchievementUnlocked + XpGranted (3), per quest XpGranted + QuestCompleted (2), one
|
|
95
|
+
* CosmeticUnlocked per cosmetic (each needs an unlock), one TierUp per threshold crossed, and a
|
|
96
|
+
* CrateGranted after each achievement / quest XP grant plus one for the crate effects an earlier
|
|
97
|
+
* `open_crates` deferred (applied once, first). Crates accumulate uncapped, so each XP grant can
|
|
98
|
+
* cross an `xp_per_crate` multiple. Progress counters are not here: one event per `game_book` call,
|
|
99
|
+
* two per close, so the leg count holds them. Each size is capped at
|
|
100
|
+
* {@link GAME_REGISTRY_MAXIMA}. At the maxima: 384 + 256 + 128 + 32 + 257 = 1,057, above Sui's
|
|
101
|
+
* 1,024 on its own (one close that fires every definition there reverts alone): with an unknown
|
|
102
|
+
* registry no retired close fits, so pass the live sizes ({@link gameEventLimitsFromDefinitions}).
|
|
103
|
+
*/
|
|
104
|
+
export declare function playerProgressionEvents(limits?: GameEventLimits): number;
|
|
105
|
+
/**
|
|
106
|
+
* The Sui client `Transaction.build` takes, from the app's own `@mysten/sui` (a 2.x
|
|
107
|
+
* `ClientWithCoreApi`; a 1.x `SuiClient` / experimental core client). Derived from `Transaction`
|
|
108
|
+
* so it typechecks on both peer versions.
|
|
109
|
+
*/
|
|
110
|
+
export type BatchCloseClient = NonNullable<NonNullable<Parameters<Transaction["build"]>[0]>["client"]>;
|
|
111
|
+
/** A batch's measured use of each {@link SUI_TX_LIMITS} (see {@link closeBatchUsage}). */
|
|
112
|
+
export interface CloseBatchUsage {
|
|
113
|
+
commands: number;
|
|
114
|
+
txBytes: number;
|
|
115
|
+
/** Every event the batch can emit: the legs' plus {@link progressionEvents}. */
|
|
116
|
+
events: number;
|
|
117
|
+
/** The game's once-per-account events, included in `events` ({@link playerProgressionEvents}). */
|
|
118
|
+
progressionEvents: number;
|
|
119
|
+
newObjectIds: number;
|
|
120
|
+
argumentsPerCommand: number;
|
|
121
|
+
/** Transaction inputs (only the sponsor limits them, {@link SPONSOR_BATCH_BUDGET}). */
|
|
122
|
+
inputs: number;
|
|
123
|
+
/** Trade calls: one per leg. */
|
|
124
|
+
trades: number;
|
|
125
|
+
/** Of those, `close_retired` legs (a sponsored tx takes one alone, {@link SPONSOR_BATCH_BUDGET}). */
|
|
126
|
+
retired: number;
|
|
127
|
+
}
|
|
128
|
+
/** One position's close inside a batch. */
|
|
129
|
+
export interface BatchCloseLeg {
|
|
130
|
+
/**
|
|
131
|
+
* A service-built `request-close` kind with no wallet top-up (its `top_up` is the service's
|
|
132
|
+
* `0x2::coin::zero`), or a `close-retired` kind.
|
|
133
|
+
*/
|
|
134
|
+
tx: Transaction;
|
|
135
|
+
/**
|
|
136
|
+
* The route and body the kind was built for: `ParchmentBuiltTx.request`. Required under
|
|
137
|
+
* `BatchCloseOptions.txTrust`, which checks the leg against it before copying it into the batch.
|
|
138
|
+
*/
|
|
139
|
+
request?: ParchmentTxRequest;
|
|
140
|
+
/**
|
|
141
|
+
* Collateral base units to put into this request's `top_up` from the wallet (see
|
|
142
|
+
* {@link closeBatchTopUps}). 0 / omitted keeps the service's zero coin. Not valid on `close-retired`.
|
|
143
|
+
*/
|
|
144
|
+
topUp?: bigint;
|
|
145
|
+
}
|
|
146
|
+
export interface BatchCloseOptions {
|
|
147
|
+
sender: string;
|
|
148
|
+
/**
|
|
149
|
+
* Re-checks each leg before it is copied into the batch, as the client's builders do:
|
|
150
|
+
* every leg needs its `request`, must be a close route for `sender` and must pass
|
|
151
|
+
* `txIntentViolation`. A later leg whose request named its own signed update is refused when an
|
|
152
|
+
* earlier leg already quotes that feed with a different one (the batch shares one update per feed,
|
|
153
|
+
* see below), since replacing it would price that close at a price its request did not name.
|
|
154
|
+
* The assembled batch is then checked to push and quote only updates the legs themselves carried.
|
|
155
|
+
* `"unchecked"`: the legs are held only to the command shapes, for a caller that already checked
|
|
156
|
+
* each kind against its request, or that trusts the API (the default when omitted).
|
|
157
|
+
*/
|
|
158
|
+
txTrust?: ParchmentTxTrustSetting;
|
|
159
|
+
/** Collateral coin type `C` (needed only when a leg has a top-up). */
|
|
160
|
+
coinType?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Sui client the wallet coin resolves with (the sender's coins / address balance), so
|
|
163
|
+
* {@link fitCloseBatch} measures the tx with its real coin inputs. Needed there when a leg has a top-up.
|
|
164
|
+
*/
|
|
165
|
+
client?: BatchCloseClient;
|
|
166
|
+
/**
|
|
167
|
+
* The session key's batch for the gas sponsor: `request_close_as_delegate` legs with no top-up, or
|
|
168
|
+
* `close_retired_as_delegate` legs with one storage push per market, fit within
|
|
169
|
+
* {@link SPONSOR_BATCH_BUDGET} as well.
|
|
170
|
+
*/
|
|
171
|
+
sponsored?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Sponsored only: the most closes one tx carries (the sponsor's served cap, or a smaller one after
|
|
174
|
+
* it refused a batch on gas). Defaults to {@link SPONSOR_BATCH_BUDGET.trades}; retired closes are
|
|
175
|
+
* held to {@link SPONSOR_BATCH_BUDGET.retiredTrades} below it.
|
|
176
|
+
*/
|
|
177
|
+
maxTrades?: number;
|
|
178
|
+
/**
|
|
179
|
+
* Game registry sizes for the retired closes' once-per-player events
|
|
180
|
+
* ({@link playerProgressionEvents}, counted per distinct account). Defaults to the contract
|
|
181
|
+
* maxima ({@link GAME_REGISTRY_MAXIMA}: 1,057 events per account, above Sui's 1,024, so no
|
|
182
|
+
* retired close fits). Pass the live sizes,
|
|
183
|
+
* `gameEventLimitsFromDefinitions(await parchment.getGameDefinitions())`, to batch more.
|
|
184
|
+
* A registry that grows between this measure and execution can still exceed the bound.
|
|
185
|
+
*/
|
|
186
|
+
gameLimits?: GameEventLimits;
|
|
187
|
+
}
|
|
188
|
+
export declare class BatchCloseError extends Error {
|
|
189
|
+
constructor(message: string);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Each request's wallet top-up so `request_close` never aborts `EInsufficientFree`: the running
|
|
193
|
+
* shortfall `fee - free` at that request, free growing by the top-up and shrinking by the fee.
|
|
194
|
+
* Exactly what `fund_close_fee` accepts while deposits are paused (at most `exec_fee - free`,
|
|
195
|
+
* `ETopUpExceedsFee` above it, C2C-001); the sum is `max(0, sum(fees) - free)`. Put the requests
|
|
196
|
+
* before any `close-retired` leg: a retired close credits its payout to free, which would shrink
|
|
197
|
+
* the later shortfalls below these top-ups. Throws {@link BatchCloseError} on a negative fee.
|
|
198
|
+
*/
|
|
199
|
+
export declare function closeBatchTopUps(execFees: readonly bigint[], free: bigint): bigint[];
|
|
200
|
+
/**
|
|
201
|
+
* One PTB with every leg's commands, in leg order. Pure inputs, Move targets and object refs are
|
|
202
|
+
* copied verbatim; objects shared by legs become one input. A leg with a `topUp` has its
|
|
203
|
+
* `coin::zero` replaced by a part of one `coinWithBalance(sum of top-ups)` coin, split once.
|
|
204
|
+
* Legs quoting the same oracle feed share the first such leg's signed update (see `appendLeg`).
|
|
205
|
+
* Throws {@link BatchCloseError} on an empty batch or a leg it can't rebuild. Does not check the
|
|
206
|
+
* size: {@link fitCloseBatch} does.
|
|
207
|
+
*/
|
|
208
|
+
export declare function batchCloseTx(legs: readonly BatchCloseLeg[], options: BatchCloseOptions): Transaction;
|
|
209
|
+
/**
|
|
210
|
+
* The longest prefix of `legs` whose batch tx stays within {@link CLOSE_BATCH_BUDGET}, and that tx.
|
|
211
|
+
* Measured on the built kind ({@link closeBatchUsage}); with top-ups, then again on the tx with its
|
|
212
|
+
* wallet coin resolved through `options.client` (`coinWithBalance` can pull in one input per coin
|
|
213
|
+
* the sender holds), and that resolved tx is the one returned. `count < legs.length` means the rest
|
|
214
|
+
* needs another tx; send it after this one confirms (its top-ups assume this one's ran). Throws
|
|
215
|
+
* {@link BatchCloseError} when not even one leg fits, or a top-up has no client.
|
|
216
|
+
*/
|
|
217
|
+
export declare function fitCloseBatch(legs: readonly BatchCloseLeg[], options: BatchCloseOptions): Promise<{
|
|
218
|
+
tx: Transaction;
|
|
219
|
+
count: number;
|
|
220
|
+
usage: CloseBatchUsage;
|
|
221
|
+
}>;
|
|
222
|
+
/**
|
|
223
|
+
* Every batch of `legs`, in order: {@link fitCloseBatch} on what is left until nothing is. For legs
|
|
224
|
+
* already built at once (their signed updates age: send each batch soon after it is built, or build
|
|
225
|
+
* per batch from {@link planCloseBatches}). Throws {@link BatchCloseError} when a leg does not fit in a
|
|
226
|
+
* tx of its own, and when a batch after the first has a wallet top-up: its coin would resolve against
|
|
227
|
+
* the wallet as it is now, the same coin version the first batch spends, so it could not execute after
|
|
228
|
+
* that one. Fit such a list one batch at a time instead: {@link fitCloseBatch} the rest (with top-ups
|
|
229
|
+
* recomputed from the free balance then) only after the previous tx confirms.
|
|
230
|
+
*/
|
|
231
|
+
export declare function splitCloseBatches(legs: readonly BatchCloseLeg[], options: BatchCloseOptions): Promise<{
|
|
232
|
+
tx: Transaction;
|
|
233
|
+
start: number;
|
|
234
|
+
count: number;
|
|
235
|
+
usage: CloseBatchUsage;
|
|
236
|
+
}[]>;
|
|
237
|
+
/** One position's close as {@link planCloseBatches} sees it, before anything is built. */
|
|
238
|
+
export interface CloseBatchPlanLeg {
|
|
239
|
+
/** A `close-retired` leg (else a `request-close`). */
|
|
240
|
+
retired: boolean;
|
|
241
|
+
/** The account a retired close settles (its once-per-player events count once per account). Unknown: counted as its own. */
|
|
242
|
+
account?: string;
|
|
243
|
+
/** A request with a wallet top-up (one more event). */
|
|
244
|
+
funded?: boolean;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Groups `legs` into consecutive batches, each one tx, from their kinds alone (no build, no network):
|
|
248
|
+
* the execution budget ({@link CLOSE_BATCH_BUDGET} events and new ids, the game's progression per
|
|
249
|
+
* account), commands, and with `sponsored` the sponsor's shapes ({@link SPONSOR_BATCH_BUDGET}:
|
|
250
|
+
* requests up to `maxTrades`, retired closes up to `min(maxTrades, retiredTrades)` per tx, never
|
|
251
|
+
* mixed). Put a market's retired closes next to each other: a sponsored batch pushes each market's
|
|
252
|
+
* update once. Returns each batch's leg indices, every leg
|
|
253
|
+
* exactly once, in order. Tx bytes are not modeled (they depend on the built kinds): the build's
|
|
254
|
+
* {@link fitCloseBatch} may carry fewer than a planned batch, and the rest joins the next one. A leg
|
|
255
|
+
* that fits in no tx (a retired close at registry sizes whose progression alone passes Sui's limit)
|
|
256
|
+
* throws {@link BatchCloseError}.
|
|
257
|
+
*/
|
|
258
|
+
export declare function planCloseBatches(legs: readonly CloseBatchPlanLeg[], options?: Pick<BatchCloseOptions, "sponsored" | "gameLimits" | "maxTrades">): number[][];
|
|
259
|
+
/**
|
|
260
|
+
* What the batch of `legs` uses of each {@link SUI_TX_LIMITS}, without network: commands and the
|
|
261
|
+
* largest argument list from its commands (the `coinWithBalance` intent as the 2 commands it
|
|
262
|
+
* resolves to at least), the kind's BCS size with a placeholder owned coin in place of the intent,
|
|
263
|
+
* and the per-leg execution counts. A lower bound with top-ups: {@link fitCloseBatch} remeasures
|
|
264
|
+
* those on the resolved tx.
|
|
265
|
+
*/
|
|
266
|
+
export declare function closeBatchUsage(legs: readonly BatchCloseLeg[], options: BatchCloseOptions): Promise<CloseBatchUsage>;
|
|
267
|
+
/** A `request_close` leg, the owner's or the session key's (`request_close_as_delegate`). */
|
|
268
|
+
export declare function legIsRequest(source: Transaction): boolean;
|