@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,119 @@
|
|
|
1
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
2
|
+
export const EVENT_REASON = { dividend: 0, earnings: 1, macro: 2, other: 3 };
|
|
3
|
+
export const EVENT_GUARD_MAX_WINDOW_MS = 86_400_000;
|
|
4
|
+
function obj(tx, o) {
|
|
5
|
+
return typeof o === "string" ? tx.object(o) : o;
|
|
6
|
+
}
|
|
7
|
+
function reasonCode(reason) {
|
|
8
|
+
const code = typeof reason === "number" ? reason : EVENT_REASON[reason];
|
|
9
|
+
if (!Number.isInteger(code) || code < 0 || code > EVENT_REASON.other)
|
|
10
|
+
throw new Error(`event_guard: bad reason ${String(reason)}`);
|
|
11
|
+
return code;
|
|
12
|
+
}
|
|
13
|
+
export function addSetEventPauseCall(tx, input) {
|
|
14
|
+
tx.moveCall({
|
|
15
|
+
target: `${input.tradePackageId}::event_guard::set_event_pause`,
|
|
16
|
+
typeArguments: [input.coinType],
|
|
17
|
+
arguments: [
|
|
18
|
+
obj(tx, input.exchange), obj(tx, input.market), obj(tx, input.config), obj(tx, input.keeperCap),
|
|
19
|
+
tx.pure.u8(reasonCode(input.reason)), tx.pure.u64(BigInt(input.untilMs)), tx.object.clock(),
|
|
20
|
+
],
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export function addClearEventPauseCall(tx, input) {
|
|
24
|
+
tx.moveCall({
|
|
25
|
+
target: `${input.tradePackageId}::event_guard::clear_event_pause`,
|
|
26
|
+
typeArguments: [input.coinType],
|
|
27
|
+
arguments: [obj(tx, input.exchange), obj(tx, input.market), obj(tx, input.config), obj(tx, input.keeperCap)],
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export function addSetEventLeverageCapCall(tx, input) {
|
|
31
|
+
tx.moveCall({
|
|
32
|
+
target: `${input.tradePackageId}::event_guard::set_event_leverage_cap`,
|
|
33
|
+
typeArguments: [input.coinType],
|
|
34
|
+
arguments: [
|
|
35
|
+
obj(tx, input.exchange), obj(tx, input.market), obj(tx, input.config), obj(tx, input.keeperCap),
|
|
36
|
+
tx.pure.u64(BigInt(input.maxLeverage)), tx.pure.u8(reasonCode(input.reason)), tx.pure.u64(BigInt(input.untilMs)),
|
|
37
|
+
tx.object.clock(),
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export function addClearEventLeverageCapCall(tx, input) {
|
|
42
|
+
tx.moveCall({
|
|
43
|
+
target: `${input.tradePackageId}::event_guard::clear_event_leverage_cap`,
|
|
44
|
+
typeArguments: [input.coinType],
|
|
45
|
+
arguments: [obj(tx, input.exchange), obj(tx, input.market), obj(tx, input.config), obj(tx, input.keeperCap)],
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export function addArmEventCloseCall(tx, input) {
|
|
49
|
+
tx.moveCall({
|
|
50
|
+
target: `${input.tradePackageId}::event_guard::arm_event_close`,
|
|
51
|
+
typeArguments: [input.coinType],
|
|
52
|
+
arguments: [
|
|
53
|
+
obj(tx, input.market), obj(tx, input.exchange), obj(tx, input.config), obj(tx, input.keeperCap), input.receipt,
|
|
54
|
+
tx.object.clock(),
|
|
55
|
+
],
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export function addEventGuardAdminClearCall(tx, input) {
|
|
59
|
+
tx.moveCall({
|
|
60
|
+
target: `${input.tradePackageId}::event_guard::admin_clear`,
|
|
61
|
+
typeArguments: [input.coinType],
|
|
62
|
+
arguments: [obj(tx, input.exchange), obj(tx, input.market), obj(tx, input.config), obj(tx, input.adminCap)],
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export const EVENT_PAUSE_UPDATED_EVENT_BCS = bcs.struct("EventPauseUpdatedEventV1", {
|
|
66
|
+
market_id: bcs.Address,
|
|
67
|
+
until_ms: bcs.u64(),
|
|
68
|
+
reason: bcs.u8(),
|
|
69
|
+
sender: bcs.Address,
|
|
70
|
+
admin: bcs.bool(),
|
|
71
|
+
});
|
|
72
|
+
export const EVENT_LEVERAGE_CAP_UPDATED_EVENT_BCS = bcs.struct("EventLeverageCapUpdatedEventV1", {
|
|
73
|
+
market_id: bcs.Address,
|
|
74
|
+
max_leverage: bcs.u64(),
|
|
75
|
+
until_ms: bcs.u64(),
|
|
76
|
+
reason: bcs.u8(),
|
|
77
|
+
sender: bcs.Address,
|
|
78
|
+
admin: bcs.bool(),
|
|
79
|
+
});
|
|
80
|
+
export const EVENT_CLOSE_ARMED_EVENT_BCS = bcs.struct("EventCloseArmedEventV1", {
|
|
81
|
+
market_id: bcs.Address,
|
|
82
|
+
reason: bcs.u8(),
|
|
83
|
+
price_wad: bcs.u128(),
|
|
84
|
+
ts_ms: bcs.u64(),
|
|
85
|
+
watermark: bcs.u64(),
|
|
86
|
+
remaining: bcs.u64(),
|
|
87
|
+
pause_until_ms: bcs.u64(),
|
|
88
|
+
sender: bcs.Address,
|
|
89
|
+
});
|
|
90
|
+
export function decodeEventPauseUpdatedEvent(bytes) {
|
|
91
|
+
try {
|
|
92
|
+
const event = EVENT_PAUSE_UPDATED_EVENT_BCS.parse(bytes);
|
|
93
|
+
return EVENT_PAUSE_UPDATED_EVENT_BCS.serialize(event).toBytes().length === bytes.length ? event : null;
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export function decodeEventLeverageCapUpdatedEvent(bytes) {
|
|
100
|
+
try {
|
|
101
|
+
const event = EVENT_LEVERAGE_CAP_UPDATED_EVENT_BCS.parse(bytes);
|
|
102
|
+
return EVENT_LEVERAGE_CAP_UPDATED_EVENT_BCS.serialize(event).toBytes().length === bytes.length ? event : null;
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
export function decodeEventCloseArmedEvent(bytes) {
|
|
109
|
+
try {
|
|
110
|
+
const event = EVENT_CLOSE_ARMED_EVENT_BCS.parse(bytes);
|
|
111
|
+
return EVENT_CLOSE_ARMED_EVENT_BCS.serialize(event).toBytes().length === bytes.length ? event : null;
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
export function eventGuardEventType(tradeOriginalId, name) {
|
|
118
|
+
return `${tradeOriginalId}::event_guard::Event<${tradeOriginalId}::event_guard::${name}>`;
|
|
119
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `parchment_game::game_events::CountersUpdatedEvent` `kinds` values (`game_events::counter_*`),
|
|
3
|
+
* numbered as the criteria kind they feed where there is one. 2 and 3 are observations of a
|
|
4
|
+
* genuine winning trade close (not stored counters); 7 (manual criteria) has no counter.
|
|
5
|
+
*/
|
|
6
|
+
export declare const GAME_COUNTER_KIND: {
|
|
7
|
+
readonly trades: 0;
|
|
8
|
+
readonly markets: 1;
|
|
9
|
+
readonly winLeverage: 2;
|
|
10
|
+
readonly winProfitBps: 3;
|
|
11
|
+
readonly winStreak: 4;
|
|
12
|
+
readonly tier: 5;
|
|
13
|
+
readonly dailyStreak: 6;
|
|
14
|
+
readonly feeCredit: 8;
|
|
15
|
+
readonly genuineCloses: 9;
|
|
16
|
+
readonly genuineVolume: 10;
|
|
17
|
+
readonly realizedGain: 11;
|
|
18
|
+
readonly cratesOpened: 12;
|
|
19
|
+
readonly questsCompleted: 13;
|
|
20
|
+
readonly realizedLoss: 14;
|
|
21
|
+
readonly crates: 15;
|
|
22
|
+
readonly feeCreditUsed: 16;
|
|
23
|
+
readonly xp: 17;
|
|
24
|
+
readonly seasonXp: 18;
|
|
25
|
+
readonly dayVolume: 19;
|
|
26
|
+
readonly dayVolumeXp: 20;
|
|
27
|
+
readonly dayWinXp: 21;
|
|
28
|
+
readonly xpDay: 22;
|
|
29
|
+
readonly seasonId: 23;
|
|
30
|
+
};
|
|
31
|
+
export type GameCounterKind = (typeof GAME_COUNTER_KIND)[keyof typeof GAME_COUNTER_KIND];
|
|
32
|
+
/**
|
|
33
|
+
* BCS for `game_events::Event<CountersUpdatedEvent>`. One per `game_book` call that changed a
|
|
34
|
+
* counter: `kinds[i]` changed to `values[i]` (the value after the call), each kind at most once,
|
|
35
|
+
* the two vectors the same nonempty length. A trade close emits two (its realized gain or loss,
|
|
36
|
+
* then the rest with a genuine win's kinds 2 and 3 first). Crate batches combine catch-up and
|
|
37
|
+
* draws and always carry XP and season XP snapshots. Other calls can emit separately in the same
|
|
38
|
+
* transaction, so keep the latest per (`player`, `kind`) by event sequence ({@link latestGameCounters}).
|
|
39
|
+
* `account` is the account `player` held on the exchange at emission, or null. Replaces the
|
|
40
|
+
* never-deployed one-per-kind `CounterUpdatedEvent`.
|
|
41
|
+
*/
|
|
42
|
+
export declare const COUNTERS_UPDATED_EVENT_BCS: import("@mysten/sui/bcs").BcsStruct<{
|
|
43
|
+
player: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
44
|
+
account: import("@mysten/sui/bcs").BcsType<string | null, string | Uint8Array<ArrayBufferLike> | null | undefined, "Option<bytes[32]>">;
|
|
45
|
+
kinds: import("@mysten/sui/bcs").BcsType<number[], Iterable<number> & {
|
|
46
|
+
length: number;
|
|
47
|
+
}, string>;
|
|
48
|
+
values: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
|
|
49
|
+
length: number;
|
|
50
|
+
}, string>;
|
|
51
|
+
}, string>;
|
|
52
|
+
export type CountersUpdatedEvent = ReturnType<typeof COUNTERS_UPDATED_EVENT_BCS.parse>;
|
|
53
|
+
/** Decode event bytes supplied by the API; null when they are not this event. */
|
|
54
|
+
export declare function decodeCountersUpdatedEvent(bytes: Uint8Array): CountersUpdatedEvent | null;
|
|
55
|
+
/**
|
|
56
|
+
* The latest value of each (player, kind) in `events`, which must be in event sequence order
|
|
57
|
+
* (within a transaction and across transactions).
|
|
58
|
+
*/
|
|
59
|
+
export declare function latestGameCounters(events: Iterable<CountersUpdatedEvent>): Map<string, Map<number, string>>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
2
|
+
export const GAME_COUNTER_KIND = {
|
|
3
|
+
trades: 0,
|
|
4
|
+
markets: 1,
|
|
5
|
+
winLeverage: 2,
|
|
6
|
+
winProfitBps: 3,
|
|
7
|
+
winStreak: 4,
|
|
8
|
+
tier: 5,
|
|
9
|
+
dailyStreak: 6,
|
|
10
|
+
feeCredit: 8,
|
|
11
|
+
genuineCloses: 9,
|
|
12
|
+
genuineVolume: 10,
|
|
13
|
+
realizedGain: 11,
|
|
14
|
+
cratesOpened: 12,
|
|
15
|
+
questsCompleted: 13,
|
|
16
|
+
realizedLoss: 14,
|
|
17
|
+
crates: 15,
|
|
18
|
+
feeCreditUsed: 16,
|
|
19
|
+
xp: 17,
|
|
20
|
+
seasonXp: 18,
|
|
21
|
+
dayVolume: 19,
|
|
22
|
+
dayVolumeXp: 20,
|
|
23
|
+
dayWinXp: 21,
|
|
24
|
+
xpDay: 22,
|
|
25
|
+
seasonId: 23,
|
|
26
|
+
};
|
|
27
|
+
export const COUNTERS_UPDATED_EVENT_BCS = bcs.struct("CountersUpdatedEvent", {
|
|
28
|
+
player: bcs.Address,
|
|
29
|
+
account: bcs.option(bcs.Address),
|
|
30
|
+
kinds: bcs.vector(bcs.u8()),
|
|
31
|
+
values: bcs.vector(bcs.u64()),
|
|
32
|
+
});
|
|
33
|
+
export function decodeCountersUpdatedEvent(bytes) {
|
|
34
|
+
try {
|
|
35
|
+
const event = COUNTERS_UPDATED_EVENT_BCS.parse(bytes);
|
|
36
|
+
if (event.kinds.length === 0 || event.kinds.length !== event.values.length)
|
|
37
|
+
return null;
|
|
38
|
+
const again = COUNTERS_UPDATED_EVENT_BCS.serialize(event).toBytes();
|
|
39
|
+
if (again.length !== bytes.length)
|
|
40
|
+
return null;
|
|
41
|
+
return event;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export function latestGameCounters(events) {
|
|
48
|
+
const out = new Map();
|
|
49
|
+
for (const event of events) {
|
|
50
|
+
let player = out.get(event.player);
|
|
51
|
+
if (!player)
|
|
52
|
+
out.set(event.player, (player = new Map()));
|
|
53
|
+
event.kinds.forEach((kind, i) => player.set(kind, event.values[i]));
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export { Parchment, parseLivePrice, parseTrade } from "./parchment.js";
|
|
2
|
+
export { ParchmentAccount } from "./parchmentAccount.js";
|
|
3
|
+
export { MARKET_STATUS_ACTIVE, MARKET_STATUS_REDUCE_ONLY, MARKET_STATUS_RETIRED, ParchmentMarket, marketIsActive, marketIsDelisted, marketIsRetired, marketMinHoldMs, marketNextSessionOpenMs, marketSessionEndsAtMs, liquidationPaused, requestsPausedMessage, } from "./parchmentMarket.js";
|
|
4
|
+
export { LOCKED_LEDGER_STATUSES, PARCHMENT_CANDLES_BATCH_MAX_MARKETS, PARCHMENT_SPONSORED_ACTIONS, TX_ACTIONS, } from "./parchmentTypes.js";
|
|
5
|
+
export { RETAINED_FEE_CURVE_DEFAULTS, RETAINED_FEE_CURVE_MAX_COV_BPS, addSetRetainedFeeCurveCall, lpRetainedFeeCurve, retainedFeeCurve, retainedStakerShareBps, } from "./retainedFee.js";
|
|
6
|
+
export type { ParchmentRetainedFeeCurve, SetRetainedFeeCurveCall } from "./retainedFee.js";
|
|
7
|
+
export { SPONSOR_IN_FLIGHT_LIMIT, SPONSOR_NOT_DELEGATE, isSessionKeyRevoked, shouldPayOwnGas, sponsorBody, } from "./sponsor.js";
|
|
8
|
+
export { SESSION_KEY_EXPIRY_MARGIN_MS, SESSION_KEY_TTL_MS, MAX_SPONSOR_PROOF_LIFETIME_MS, SPONSOR_PROOF_LIFETIME_MS, assertSessionTradeKind, createSessionKey, isSponsoredCopyOf, liveSessionDelegate, sessionKeyExpiryMs, sessionKeyFromSecret, sessionKeySecret, signSessionSponsoredTx, signSponsorProof, sponsorProofMessage, } from "./sessionKey.js";
|
|
9
|
+
export type { ParchmentSessionKey, ParchmentSponsorProof } from "./sessionKey.js";
|
|
10
|
+
export { NEAR_LIQ_DISTANCE_FRACTION, TRIGGER_PROOF_TTL_MS, TRIGGER_PROOF_VERSION, newTriggerIntentId, signTriggerProof, stopAgainstLiquidation, triggerBindBody, triggerPrepareBody, triggerProofMessage, triggerRequestBody, } from "./triggers.js";
|
|
11
|
+
export type { StopPlacement, TriggerBindInput, TriggerIntentTarget, TriggerKind, TriggerProof, TriggerProofInput, TriggerSigner, TriggerTarget, } from "./triggers.js";
|
|
12
|
+
export { BatchCloseError, CLOSE_BATCH_BUDGET, GAME_REGISTRY_MAXIMA, SPONSOR_BATCH_BUDGET, SUI_TX_LIMITS, batchCloseTx, closeBatchTopUps, closeBatchUsage, fitCloseBatch, gameEventLimitsFromDefinitions, legIsRequest, planCloseBatches, playerProgressionEvents, splitCloseBatches, } from "./batchClose.js";
|
|
13
|
+
export type { BatchCloseClient, BatchCloseLeg, BatchCloseOptions, CloseBatchPlanLeg, CloseBatchUsage, GameEventLimits } from "./batchClose.js";
|
|
14
|
+
export { FORCE_CLOSE_SESSION_MAX_IDS, addArmSessionCloseAdminCall, addArmSessionCloseCall, addForceCloseSessionCall, addSessionRefundCall, } from "./sessionClose.js";
|
|
15
|
+
export type { ArmSessionCloseAdminCall, ArmSessionCloseCall, ForceCloseSessionCall, SessionRefundCall } from "./sessionClose.js";
|
|
16
|
+
export { addMintPendingForCalls, buildMintPendingForTx } from "./liquidationCredit.js";
|
|
17
|
+
export type { MintPendingForCalls } from "./liquidationCredit.js";
|
|
18
|
+
export { EVENT_CLOSE_ARMED_EVENT_BCS, EVENT_GUARD_MAX_WINDOW_MS, EVENT_LEVERAGE_CAP_UPDATED_EVENT_BCS, EVENT_PAUSE_UPDATED_EVENT_BCS, EVENT_REASON, addArmEventCloseCall, addClearEventLeverageCapCall, addClearEventPauseCall, addEventGuardAdminClearCall, addSetEventLeverageCapCall, addSetEventPauseCall, decodeEventCloseArmedEvent, decodeEventLeverageCapUpdatedEvent, decodeEventPauseUpdatedEvent, eventGuardEventType, } from "./eventGuard.js";
|
|
19
|
+
export type { ArmEventCloseCall, EventCloseArmedEvent, EventGuardAdminClearCall, EventKeeperCall, EventLeverageCapUpdatedEvent, EventPauseUpdatedEvent, EventReason, SetEventLeverageCapCall, SetEventPauseCall, } from "./eventGuard.js";
|
|
20
|
+
export { addOneSignatureOnboardingCalls, deriveAccountId } from "./onboarding.js";
|
|
21
|
+
export type { AccountIdInput, OneSignatureOnboardingCalls } from "./onboarding.js";
|
|
22
|
+
export { PARCHMENT_TRADE_MODULES, isParchmentTradeModule, parchmentBaseTypePackageId, parchmentCallPackageId, parchmentCoreTypePackageId, parchmentGameTypePackageId, parchmentMintTypePackageId, parchmentTradeTypePackageId, requireSplitPackageIds, } from "./packageIds.js";
|
|
23
|
+
export type { ParchmentTradeModule } from "./packageIds.js";
|
|
24
|
+
export type * from "./parchmentTypes.js";
|
|
25
|
+
export { boundFromSlippage } from "./slippage.js";
|
|
26
|
+
export type { SlippageAction, SlippageSide } from "./slippage.js";
|
|
27
|
+
export { FEE_MINT_ABORT_MESSAGES, FEE_MINT_ABORT_NAMES, MARKET_ABORT_MESSAGES, MARKET_ABORT_NAMES, ORDER_ABORT_MESSAGES, ORDER_ABORT_NAMES, ORACLE_RESERVED_ABORT_CODES, ORDER_RESERVED_ABORT_CODES, TRADE_ABORT_MESSAGES, TRADE_ABORT_NAMES, TRADE_RESERVED_ABORT_CODES, abortMessage, abortName, decodeAbortCode, orderAbortMessage, orderAbortName, tradeAbortMessage, ACCESS_ABORT_NAMES, ACCOUNT_ABORT_NAMES, CONFIG_ABORT_NAMES, BUILDER_ABORT_NAMES, REFERRAL_ABORT_NAMES, STAKING_ABORT_NAMES, DECLARED_NOT_RAISED_ABORT_CODES, EXCHANGE_ABORT_NAMES, HOLDER_BOOK_ABORT_NAMES, ACCOUNT_TRANSFER_ABORT_NAMES, ABORT_MODULE_PATHS, ABORT_NAME_MAPS, AUTHORITY_ABORT_NAMES, FEES_ABORT_NAMES, GAME_ABORT_MESSAGES, GAME_ABORT_NAMES, KEEPER_ABORT_NAMES, EVENT_GUARD_ABORT_NAMES, LIQ_BOOK_ABORT_NAMES, LP_ABORT_NAMES, ORACLE_ABORT_NAMES, ORACLE_ADAPTER_ABORT_NAMES, POSITION_ABORT_NAMES, TIMELOCK_ABORT_NAMES, LOCKED_MINT_ABORT_NAMES, MINT_CAP_ABORT_NAMES, UNCOVERED_MODULES, } from "./abortCodes.js";
|
|
28
|
+
export { MIN_CANCEL_DELAY_MS, ORDER_FINALIZED_EVENT_BCS, ORDER_OUTCOMES, ORDER_REFUND_SESSION_MESSAGE, ORDER_REQUESTED_EVENT_BCS, decodeOrderFinalizedEvent, decodeOrderRequestedEvent, effectiveCancelAfterMs, finalizedOrdersFromTx, orderExpiresAfterMs, orderOutcome, requestedOrderIdFromTx, requestedOrdersFromTx, } from "./orderEffects.js";
|
|
29
|
+
export type { FinalizedOrderRef, OrderFinalizedEventV1, OrderRequestedEventV1, ParchmentExecutedEventLike, ParchmentExecutedTxLike, ParchmentPackageScope, RequestedOrderRef, } from "./orderEffects.js";
|
|
30
|
+
export { EMERGENCY_CLOSE_DISABLED_MS, ORDER_PARAMS_V1_BCS, decodeOrderParams, emergencyCloseDisabled, hasPendingOrderSlot, isEmergencyAfterDisabled, orderParamsFromJson, } from "./orderParams.js";
|
|
31
|
+
export type { OrderParamsV1 } from "./orderParams.js";
|
|
32
|
+
export { ORDER_TX_NOTE } from "./notes.js";
|
|
33
|
+
export { PUBLIC_INTS } from "./publicInts.js";
|
|
34
|
+
export { MONITORING_MAX_DAYS, monitoringPath, monitoringView, STAKING_HISTORY_WINDOWS, stakingHistoryPath, stakingHistoryView, statsActivityPath, statsActivityView, } from "./monitoring.js";
|
|
35
|
+
export type * from "./monitoring.js";
|
|
36
|
+
export { bindTradingReferrerTxBody, transferAccountTxBody, cancelOrderTxBody, claimPendingMintTxBody, claimQuestTxBody, claimTxBody, exitEarlyBoundedTxBody, MAX_LOCKED_ENTRIES, exitEarlyTxBody, releaseUnlockedTxBody, closePreviewBody, closeRetiredTxBody, depositTxBody, gameTxBody, openCratesTxBody, installTreasuryTxBody, lpHarvestTxBody, openAccountTxBody, registerBuilderTxBody, setBuilderPayoutTxBody, createBuilderTxBody, setBuilderFeeTxBody, builderOwnerTxBody, transferBuilderTxBody, approveBuilderTxBody, revokeBuilderApprovalTxBody, BUILDER_FEE_HARD_BPS, MAX_BUILDER_CREATE_FEE, setBuilderCreateFeeTxBody, stakeTxBody, sweepSurplusTxBody, unstakeTxBody, withdrawTxBody, closeRetiredAsDelegateTxBody, emergencyCloseAsDelegateTxBody, grantDelegateTxBody, grantCloseDelegateTxBody, grantSessionAndTriggerTxBody, revokeSessionAndTriggerTxBody, revokeDelegateTxBody, emergencyCloseTxBody, expireOrderTxBody, openPreviewBody, orderRefTxBody, requestCloseAsDelegateTxBody, requestCloseTxBody, requestOpenAsDelegateTxBody, requestOpenTxBody, assertDelegateLiveThroughFill, DELEGATE_FILL_MARGIN_MS, } from "./txBodies.js";
|
|
37
|
+
export { UNCHECKED_TX, txIntentViolation, untrustedConfigPackages } from "./txIntent.js";
|
|
38
|
+
export type { ParchmentTrustedPackages, ParchmentTxTrust, ParchmentTxTrustSetting } from "./txIntent.js";
|
|
39
|
+
export { STAKING_DURATION_CAPS_UPDATED_EVENT_BCS, decodeStakingDurationCapsUpdatedEvent, LOCKED_WEIGHT_SYNCED_EVENT_BCS, LOCKED_YIELD_CLAIMED_EVENT_BCS, LOCKED_YIELD_FORFEITED_EVENT_BCS, LOCKED_WEIGHT_BPS_UPDATED_EVENT_BCS, decodeLockedWeightSyncedEvent, decodeLockedYieldClaimedEvent, decodeLockedYieldForfeitedEvent, decodeLockedWeightBpsUpdatedEvent, } from "./stakingEvents.js";
|
|
40
|
+
export type { StakingDurationCapsUpdatedEventV1, LockedWeightSyncedEventV1, LockedYieldClaimedEventV1, LockedYieldForfeitedEventV1, LockedWeightBpsUpdatedEventV1, } from "./stakingEvents.js";
|
|
41
|
+
export { addSyncLockedCall, addSyncLockedCalls, addForfeitLockedYieldCall } from "./stakingCalls.js";
|
|
42
|
+
export type { SyncLockedCall } from "./stakingCalls.js";
|
|
43
|
+
export { TRIGGER_LEVELS_COMMITTED_BCS, TRIGGER_LEVELS_SET_EVENT_BCS, decodeTriggerLevelsCommitted, decodeTriggerLevelsSetEvent } from "./triggerEvents.js";
|
|
44
|
+
export type { TriggerLevelsCommitted, TriggerLevelsSetEvent } from "./triggerEvents.js";
|
|
45
|
+
export { addRequestOpenWithTriggersCall, addRequestOpenWithTriggersAsDelegateCall, addSetTriggerLevelsCall, addSetTriggerLevelsAsDelegateCall } from "./triggerCalls.js";
|
|
46
|
+
export type { TriggerOpenCall, TriggerOpenWithCapCall, TriggerEditCall, TriggerEditWithCapCall, TriggerEditAsDelegateCall } from "./triggerCalls.js";
|
|
47
|
+
export { COUNTERS_UPDATED_EVENT_BCS, GAME_COUNTER_KIND, decodeCountersUpdatedEvent, latestGameCounters, } from "./gameCounterEvents.js";
|
|
48
|
+
export type { CountersUpdatedEvent, GameCounterKind } from "./gameCounterEvents.js";
|
|
49
|
+
export { POSITIONS_RECONCILED_EVENT_BCS, POSITION_RECONCILED_EVENT_BCS, decodePositionReconciledEvent, decodePositionsReconciledEvent, } from "./reconcileEvents.js";
|
|
50
|
+
export type { PositionReconciledEvent, PositionsReconciledEvent } from "./reconcileEvents.js";
|
|
51
|
+
export { LEDGER_FULL_PARKED_EVENT_BCS, LOCKED_MINT_SCHEDULE_UPDATED_EVENT_BCS, PARKED_MINT_CLAIMED_EVENT_BCS, decodeLedgerFullParkedEvent, decodeLockedMintScheduleUpdatedEvent, decodeParkedMintClaimedEvent, } from "./lockedMintEvents.js";
|
|
52
|
+
export type { LedgerFullParkedEventV1, LockedMintScheduleUpdatedEventV1, ParkedMintClaimedEventV1 } from "./lockedMintEvents.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export { Parchment, parseLivePrice, parseTrade } from "./parchment.js";
|
|
2
|
+
export { ParchmentAccount } from "./parchmentAccount.js";
|
|
3
|
+
export { MARKET_STATUS_ACTIVE, MARKET_STATUS_REDUCE_ONLY, MARKET_STATUS_RETIRED, ParchmentMarket, marketIsActive, marketIsDelisted, marketIsRetired, marketMinHoldMs, marketNextSessionOpenMs, marketSessionEndsAtMs, liquidationPaused, requestsPausedMessage, } from "./parchmentMarket.js";
|
|
4
|
+
export { LOCKED_LEDGER_STATUSES, PARCHMENT_CANDLES_BATCH_MAX_MARKETS, PARCHMENT_SPONSORED_ACTIONS, TX_ACTIONS, } from "./parchmentTypes.js";
|
|
5
|
+
export { RETAINED_FEE_CURVE_DEFAULTS, RETAINED_FEE_CURVE_MAX_COV_BPS, addSetRetainedFeeCurveCall, lpRetainedFeeCurve, retainedFeeCurve, retainedStakerShareBps, } from "./retainedFee.js";
|
|
6
|
+
export { SPONSOR_IN_FLIGHT_LIMIT, SPONSOR_NOT_DELEGATE, isSessionKeyRevoked, shouldPayOwnGas, sponsorBody, } from "./sponsor.js";
|
|
7
|
+
export { SESSION_KEY_EXPIRY_MARGIN_MS, SESSION_KEY_TTL_MS, MAX_SPONSOR_PROOF_LIFETIME_MS, SPONSOR_PROOF_LIFETIME_MS, assertSessionTradeKind, createSessionKey, isSponsoredCopyOf, liveSessionDelegate, sessionKeyExpiryMs, sessionKeyFromSecret, sessionKeySecret, signSessionSponsoredTx, signSponsorProof, sponsorProofMessage, } from "./sessionKey.js";
|
|
8
|
+
export { NEAR_LIQ_DISTANCE_FRACTION, TRIGGER_PROOF_TTL_MS, TRIGGER_PROOF_VERSION, newTriggerIntentId, signTriggerProof, stopAgainstLiquidation, triggerBindBody, triggerPrepareBody, triggerProofMessage, triggerRequestBody, } from "./triggers.js";
|
|
9
|
+
export { BatchCloseError, CLOSE_BATCH_BUDGET, GAME_REGISTRY_MAXIMA, SPONSOR_BATCH_BUDGET, SUI_TX_LIMITS, batchCloseTx, closeBatchTopUps, closeBatchUsage, fitCloseBatch, gameEventLimitsFromDefinitions, legIsRequest, planCloseBatches, playerProgressionEvents, splitCloseBatches, } from "./batchClose.js";
|
|
10
|
+
export { FORCE_CLOSE_SESSION_MAX_IDS, addArmSessionCloseAdminCall, addArmSessionCloseCall, addForceCloseSessionCall, addSessionRefundCall, } from "./sessionClose.js";
|
|
11
|
+
export { addMintPendingForCalls, buildMintPendingForTx } from "./liquidationCredit.js";
|
|
12
|
+
export { EVENT_CLOSE_ARMED_EVENT_BCS, EVENT_GUARD_MAX_WINDOW_MS, EVENT_LEVERAGE_CAP_UPDATED_EVENT_BCS, EVENT_PAUSE_UPDATED_EVENT_BCS, EVENT_REASON, addArmEventCloseCall, addClearEventLeverageCapCall, addClearEventPauseCall, addEventGuardAdminClearCall, addSetEventLeverageCapCall, addSetEventPauseCall, decodeEventCloseArmedEvent, decodeEventLeverageCapUpdatedEvent, decodeEventPauseUpdatedEvent, eventGuardEventType, } from "./eventGuard.js";
|
|
13
|
+
export { addOneSignatureOnboardingCalls, deriveAccountId } from "./onboarding.js";
|
|
14
|
+
export { PARCHMENT_TRADE_MODULES, isParchmentTradeModule, parchmentBaseTypePackageId, parchmentCallPackageId, parchmentCoreTypePackageId, parchmentGameTypePackageId, parchmentMintTypePackageId, parchmentTradeTypePackageId, requireSplitPackageIds, } from "./packageIds.js";
|
|
15
|
+
export { boundFromSlippage } from "./slippage.js";
|
|
16
|
+
export { FEE_MINT_ABORT_MESSAGES, FEE_MINT_ABORT_NAMES, MARKET_ABORT_MESSAGES, MARKET_ABORT_NAMES, ORDER_ABORT_MESSAGES, ORDER_ABORT_NAMES, ORACLE_RESERVED_ABORT_CODES, ORDER_RESERVED_ABORT_CODES, TRADE_ABORT_MESSAGES, TRADE_ABORT_NAMES, TRADE_RESERVED_ABORT_CODES, abortMessage, abortName, decodeAbortCode, orderAbortMessage, orderAbortName, tradeAbortMessage, ACCESS_ABORT_NAMES, ACCOUNT_ABORT_NAMES, CONFIG_ABORT_NAMES, BUILDER_ABORT_NAMES, REFERRAL_ABORT_NAMES, STAKING_ABORT_NAMES, DECLARED_NOT_RAISED_ABORT_CODES, EXCHANGE_ABORT_NAMES, HOLDER_BOOK_ABORT_NAMES, ACCOUNT_TRANSFER_ABORT_NAMES, ABORT_MODULE_PATHS, ABORT_NAME_MAPS, AUTHORITY_ABORT_NAMES, FEES_ABORT_NAMES, GAME_ABORT_MESSAGES, GAME_ABORT_NAMES, KEEPER_ABORT_NAMES, EVENT_GUARD_ABORT_NAMES, LIQ_BOOK_ABORT_NAMES, LP_ABORT_NAMES, ORACLE_ABORT_NAMES, ORACLE_ADAPTER_ABORT_NAMES, POSITION_ABORT_NAMES, TIMELOCK_ABORT_NAMES, LOCKED_MINT_ABORT_NAMES, MINT_CAP_ABORT_NAMES, UNCOVERED_MODULES, } from "./abortCodes.js";
|
|
17
|
+
export { MIN_CANCEL_DELAY_MS, ORDER_FINALIZED_EVENT_BCS, ORDER_OUTCOMES, ORDER_REFUND_SESSION_MESSAGE, ORDER_REQUESTED_EVENT_BCS, decodeOrderFinalizedEvent, decodeOrderRequestedEvent, effectiveCancelAfterMs, finalizedOrdersFromTx, orderExpiresAfterMs, orderOutcome, requestedOrderIdFromTx, requestedOrdersFromTx, } from "./orderEffects.js";
|
|
18
|
+
export { EMERGENCY_CLOSE_DISABLED_MS, ORDER_PARAMS_V1_BCS, decodeOrderParams, emergencyCloseDisabled, hasPendingOrderSlot, isEmergencyAfterDisabled, orderParamsFromJson, } from "./orderParams.js";
|
|
19
|
+
export { ORDER_TX_NOTE } from "./notes.js";
|
|
20
|
+
export { PUBLIC_INTS } from "./publicInts.js";
|
|
21
|
+
export { MONITORING_MAX_DAYS, monitoringPath, monitoringView, STAKING_HISTORY_WINDOWS, stakingHistoryPath, stakingHistoryView, statsActivityPath, statsActivityView, } from "./monitoring.js";
|
|
22
|
+
export { bindTradingReferrerTxBody, transferAccountTxBody, cancelOrderTxBody, claimPendingMintTxBody, claimQuestTxBody, claimTxBody, exitEarlyBoundedTxBody, MAX_LOCKED_ENTRIES, exitEarlyTxBody, releaseUnlockedTxBody, closePreviewBody, closeRetiredTxBody, depositTxBody, gameTxBody, openCratesTxBody, installTreasuryTxBody, lpHarvestTxBody, openAccountTxBody, registerBuilderTxBody, setBuilderPayoutTxBody, createBuilderTxBody, setBuilderFeeTxBody, builderOwnerTxBody, transferBuilderTxBody, approveBuilderTxBody, revokeBuilderApprovalTxBody, BUILDER_FEE_HARD_BPS, MAX_BUILDER_CREATE_FEE, setBuilderCreateFeeTxBody, stakeTxBody, sweepSurplusTxBody, unstakeTxBody, withdrawTxBody, closeRetiredAsDelegateTxBody, emergencyCloseAsDelegateTxBody, grantDelegateTxBody, grantCloseDelegateTxBody, grantSessionAndTriggerTxBody, revokeSessionAndTriggerTxBody, revokeDelegateTxBody, emergencyCloseTxBody, expireOrderTxBody, openPreviewBody, orderRefTxBody, requestCloseAsDelegateTxBody, requestCloseTxBody, requestOpenAsDelegateTxBody, requestOpenTxBody, assertDelegateLiveThroughFill, DELEGATE_FILL_MARGIN_MS, } from "./txBodies.js";
|
|
23
|
+
export { UNCHECKED_TX, txIntentViolation, untrustedConfigPackages } from "./txIntent.js";
|
|
24
|
+
export { STAKING_DURATION_CAPS_UPDATED_EVENT_BCS, decodeStakingDurationCapsUpdatedEvent, LOCKED_WEIGHT_SYNCED_EVENT_BCS, LOCKED_YIELD_CLAIMED_EVENT_BCS, LOCKED_YIELD_FORFEITED_EVENT_BCS, LOCKED_WEIGHT_BPS_UPDATED_EVENT_BCS, decodeLockedWeightSyncedEvent, decodeLockedYieldClaimedEvent, decodeLockedYieldForfeitedEvent, decodeLockedWeightBpsUpdatedEvent, } from "./stakingEvents.js";
|
|
25
|
+
export { addSyncLockedCall, addSyncLockedCalls, addForfeitLockedYieldCall } from "./stakingCalls.js";
|
|
26
|
+
export { TRIGGER_LEVELS_COMMITTED_BCS, TRIGGER_LEVELS_SET_EVENT_BCS, decodeTriggerLevelsCommitted, decodeTriggerLevelsSetEvent } from "./triggerEvents.js";
|
|
27
|
+
export { addRequestOpenWithTriggersCall, addRequestOpenWithTriggersAsDelegateCall, addSetTriggerLevelsCall, addSetTriggerLevelsAsDelegateCall } from "./triggerCalls.js";
|
|
28
|
+
export { COUNTERS_UPDATED_EVENT_BCS, GAME_COUNTER_KIND, decodeCountersUpdatedEvent, latestGameCounters, } from "./gameCounterEvents.js";
|
|
29
|
+
export { POSITIONS_RECONCILED_EVENT_BCS, POSITION_RECONCILED_EVENT_BCS, decodePositionReconciledEvent, decodePositionsReconciledEvent, } from "./reconcileEvents.js";
|
|
30
|
+
export { LEDGER_FULL_PARKED_EVENT_BCS, LOCKED_MINT_SCHEDULE_UPDATED_EVENT_BCS, PARKED_MINT_CLAIMED_EVENT_BCS, decodeLedgerFullParkedEvent, decodeLockedMintScheduleUpdatedEvent, decodeParkedMintClaimedEvent, } from "./lockedMintEvents.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Transaction, type TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
2
|
+
type ObjectInput = string | TransactionObjectArgument;
|
|
3
|
+
export interface MintPendingForCalls {
|
|
4
|
+
/**
|
|
5
|
+
* `parchment_token` package id with `tokenomics::mint_pending_for`.
|
|
6
|
+
* The 2026-10-28 packages do not have it: gate on the deployment, never fall back to it.
|
|
7
|
+
*/
|
|
8
|
+
tokenPackageId: string;
|
|
9
|
+
/** Collateral coin type `C`. */
|
|
10
|
+
coinType: string;
|
|
11
|
+
exchange: ObjectInput;
|
|
12
|
+
config: ObjectInput;
|
|
13
|
+
/** Accounts whose parked mint to credit. Duplicates are dropped (a repeat would be a no-op). */
|
|
14
|
+
accountIds: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Appends one permissionless `tokenomics::mint_pending_for<C>(exchange, config, account, clock)` per
|
|
18
|
+
* distinct account, e.g. after the liquidation commands of a keeper PTB. Each credits the account's
|
|
19
|
+
* parked loss mint into its owner's locked ledger (never the sender's) and never aborts while fee
|
|
20
|
+
* mints are paused, when nothing is parked, or when the owner's ledger is full (the basis stays
|
|
21
|
+
* parked). The account is read-only. Returns the number of calls appended.
|
|
22
|
+
*/
|
|
23
|
+
export declare function addMintPendingForCalls(tx: Transaction, input: MintPendingForCalls): number;
|
|
24
|
+
/** A transaction that only credits `accountIds` (a sweeper for accounts a liquidation batch left parked). */
|
|
25
|
+
export declare function buildMintPendingForTx(input: MintPendingForCalls & {
|
|
26
|
+
sender?: string;
|
|
27
|
+
}): Transaction;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
|
+
import { normalizeSuiObjectId } from "@mysten/sui/utils";
|
|
3
|
+
const obj = (tx, o) => (typeof o === "string" ? tx.object(o) : o);
|
|
4
|
+
export function addMintPendingForCalls(tx, input) {
|
|
5
|
+
const seen = new Set();
|
|
6
|
+
for (const id of input.accountIds) {
|
|
7
|
+
const key = normalizeSuiObjectId(id);
|
|
8
|
+
if (seen.has(key))
|
|
9
|
+
continue;
|
|
10
|
+
seen.add(key);
|
|
11
|
+
tx.moveCall({
|
|
12
|
+
target: `${input.tokenPackageId}::tokenomics::mint_pending_for`,
|
|
13
|
+
typeArguments: [input.coinType],
|
|
14
|
+
arguments: [obj(tx, input.exchange), obj(tx, input.config), tx.object(key), tx.object.clock()],
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return seen.size;
|
|
18
|
+
}
|
|
19
|
+
export function buildMintPendingForTx(input) {
|
|
20
|
+
const tx = new Transaction();
|
|
21
|
+
if (input.sender)
|
|
22
|
+
tx.setSender(input.sender);
|
|
23
|
+
addMintPendingForCalls(tx, input);
|
|
24
|
+
return tx;
|
|
25
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BCS for `parchment_mint::locked_mint::Event<LockedMintScheduleUpdatedEventV1>`:
|
|
3
|
+
* `set_schedule` changed the lock and vest of new credits. Existing entries keep theirs.
|
|
4
|
+
*/
|
|
5
|
+
export declare const LOCKED_MINT_SCHEDULE_UPDATED_EVENT_BCS: import("@mysten/sui/bcs").BcsStruct<{
|
|
6
|
+
exchange_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
7
|
+
lock_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
8
|
+
vest_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
9
|
+
}, string>;
|
|
10
|
+
/**
|
|
11
|
+
* BCS for `Event<LedgerFullParkedEventV1>`: a credit found the owner's lock ledger full and was
|
|
12
|
+
* parked. `kind` 0: a loss mint (basis to the account's pending basis, claim with
|
|
13
|
+
* `claim_pending_ticket`); 1: a parked claim left parked; 2: game issuance left pending
|
|
14
|
+
* (`account_id` none, basis 0).
|
|
15
|
+
*/
|
|
16
|
+
export declare const LEDGER_FULL_PARKED_EVENT_BCS: import("@mysten/sui/bcs").BcsStruct<{
|
|
17
|
+
exchange_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
18
|
+
owner: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
19
|
+
account_id: import("@mysten/sui/bcs").BcsType<string | null, string | Uint8Array<ArrayBufferLike> | null | undefined, "Option<bytes[32]>">;
|
|
20
|
+
basis: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
21
|
+
kind: import("@mysten/sui/bcs").BcsType<number, number, "u8">;
|
|
22
|
+
}, string>;
|
|
23
|
+
/**
|
|
24
|
+
* BCS for `Event<ParkedMintClaimedEventV1>`: a bounded claim took `epochs` parked loss days
|
|
25
|
+
* (at most 64). `remaining_epochs` and `remaining_basis` are still parked; claim again for them.
|
|
26
|
+
*/
|
|
27
|
+
export declare const PARKED_MINT_CLAIMED_EVENT_BCS: import("@mysten/sui/bcs").BcsStruct<{
|
|
28
|
+
exchange_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
29
|
+
account_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
30
|
+
epochs: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
31
|
+
basis: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
32
|
+
amount: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
33
|
+
remaining_epochs: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
34
|
+
remaining_basis: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
|
|
35
|
+
}, string>;
|
|
36
|
+
export type LockedMintScheduleUpdatedEventV1 = ReturnType<typeof LOCKED_MINT_SCHEDULE_UPDATED_EVENT_BCS.parse>;
|
|
37
|
+
export type LedgerFullParkedEventV1 = ReturnType<typeof LEDGER_FULL_PARKED_EVENT_BCS.parse>;
|
|
38
|
+
export type ParkedMintClaimedEventV1 = ReturnType<typeof PARKED_MINT_CLAIMED_EVENT_BCS.parse>;
|
|
39
|
+
/** Decode event bytes supplied by the API; null when they do not parse. */
|
|
40
|
+
export declare function decodeLockedMintScheduleUpdatedEvent(bytes: Uint8Array): LockedMintScheduleUpdatedEventV1 | null;
|
|
41
|
+
export declare function decodeLedgerFullParkedEvent(bytes: Uint8Array): LedgerFullParkedEventV1 | null;
|
|
42
|
+
export declare function decodeParkedMintClaimedEvent(bytes: Uint8Array): ParkedMintClaimedEventV1 | null;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
2
|
+
export const LOCKED_MINT_SCHEDULE_UPDATED_EVENT_BCS = bcs.struct("LockedMintScheduleUpdatedEventV1", {
|
|
3
|
+
exchange_id: bcs.Address,
|
|
4
|
+
lock_ms: bcs.u64(),
|
|
5
|
+
vest_ms: bcs.u64(),
|
|
6
|
+
});
|
|
7
|
+
export const LEDGER_FULL_PARKED_EVENT_BCS = bcs.struct("LedgerFullParkedEventV1", {
|
|
8
|
+
exchange_id: bcs.Address,
|
|
9
|
+
owner: bcs.Address,
|
|
10
|
+
account_id: bcs.option(bcs.Address),
|
|
11
|
+
basis: bcs.u64(),
|
|
12
|
+
kind: bcs.u8(),
|
|
13
|
+
});
|
|
14
|
+
export const PARKED_MINT_CLAIMED_EVENT_BCS = bcs.struct("ParkedMintClaimedEventV1", {
|
|
15
|
+
exchange_id: bcs.Address,
|
|
16
|
+
account_id: bcs.Address,
|
|
17
|
+
epochs: bcs.u64(),
|
|
18
|
+
basis: bcs.u64(),
|
|
19
|
+
amount: bcs.u64(),
|
|
20
|
+
remaining_epochs: bcs.u64(),
|
|
21
|
+
remaining_basis: bcs.u64(),
|
|
22
|
+
});
|
|
23
|
+
export function decodeLockedMintScheduleUpdatedEvent(bytes) {
|
|
24
|
+
try {
|
|
25
|
+
return LOCKED_MINT_SCHEDULE_UPDATED_EVENT_BCS.parse(bytes);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function decodeLedgerFullParkedEvent(bytes) {
|
|
32
|
+
try {
|
|
33
|
+
return LEDGER_FULL_PARKED_EVENT_BCS.parse(bytes);
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export function decodeParkedMintClaimedEvent(bytes) {
|
|
40
|
+
try {
|
|
41
|
+
return PARKED_MINT_CLAIMED_EVENT_BCS.parse(bytes);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|