@bordrless/shared 0.8.0 → 0.9.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/README.md +8 -3
- package/dist/api.d.ts +500 -2
- package/dist/api.js +0 -5
- package/dist/explorer.d.ts +21 -0
- package/dist/explorer.js +94 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/policy.d.ts +100 -27
- package/dist/policy.js +185 -34
- package/dist/studio.d.ts +63 -1
- package/dist/studio.js +1 -1
- package/dist/workshop.d.ts +352 -0
- package/dist/workshop.js +21 -0
- package/package.json +1 -1
package/dist/explorer.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The explorer's words for the chain: each program's name, each IDL event's label in plain words
|
|
3
|
+
* and the account it is mostly about, in one table the backend and the site both read (the backend
|
|
4
|
+
* picks an event's subject with it; the site prints its label with the raw name as a title).
|
|
5
|
+
*
|
|
6
|
+
* Event names are the IDLs' (`packages/sdk/idl/*.json`), PascalCase; the SDK's coder gives them
|
|
7
|
+
* camelCase, which `eventName` undoes. An event the table does not know keeps its raw name, spaced.
|
|
8
|
+
*/
|
|
9
|
+
import { PROGRAM_IDS } from "./programs.js";
|
|
10
|
+
/** Which group a program id belongs to: the five of Bordrless, or any other program the indexer follows (a token hook). */
|
|
11
|
+
export function explorerProgramOf(programId) {
|
|
12
|
+
switch (programId) {
|
|
13
|
+
case PROGRAM_IDS.token:
|
|
14
|
+
return 'token';
|
|
15
|
+
case PROGRAM_IDS.swap:
|
|
16
|
+
return 'swap';
|
|
17
|
+
case PROGRAM_IDS.bridge:
|
|
18
|
+
return 'bridge';
|
|
19
|
+
case PROGRAM_IDS.launch:
|
|
20
|
+
return 'launch';
|
|
21
|
+
case PROGRAM_IDS.kit:
|
|
22
|
+
return 'kit';
|
|
23
|
+
default:
|
|
24
|
+
return 'hook';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** The groups' names, as the explorer's filter and its chips print them. */
|
|
28
|
+
export const EXPLORER_PROGRAM_NAMES = { token: 'Token', swap: 'DEX', bridge: 'Bridge', launch: 'Launchpad', kit: 'Kit', hook: 'Hook' };
|
|
29
|
+
/** A program's name: one of the five, a hook Bordrless wrote, or "Hook" for any other. */
|
|
30
|
+
export function programLabel(programId) {
|
|
31
|
+
if (programId === PROGRAM_IDS.taxHook)
|
|
32
|
+
return 'Tax hook';
|
|
33
|
+
if (programId === PROGRAM_IDS.halfLife)
|
|
34
|
+
return 'Half-Life';
|
|
35
|
+
return EXPLORER_PROGRAM_NAMES[explorerProgramOf(programId)];
|
|
36
|
+
}
|
|
37
|
+
/** The IDL's PascalCase name from whatever case the coder stored (`transferred` -> `Transferred`). */
|
|
38
|
+
export const eventName = (raw) => (raw ? `${raw.charAt(0).toUpperCase()}${raw.slice(1)}` : raw);
|
|
39
|
+
/** Every event of the IDLs, by its PascalCase name (`ConfigSet` is three programs' and reads the same). */
|
|
40
|
+
export const EVENT_WORDS = {
|
|
41
|
+
// token
|
|
42
|
+
MintCreated: { label: 'Mint created', subject: 'mint' },
|
|
43
|
+
HoldingCreated: { label: 'Holding opened', subject: 'holding' },
|
|
44
|
+
Transferred: { label: 'Transfer', subject: 'mint' },
|
|
45
|
+
Minted: { label: 'Mint', subject: 'mint' },
|
|
46
|
+
Burned: { label: 'Burn', subject: 'mint' },
|
|
47
|
+
HookSet: { label: 'Hook set', subject: 'mint' },
|
|
48
|
+
AuthoritySet: { label: 'Authority set', subject: 'mint' },
|
|
49
|
+
MetadataUpdated: { label: 'Metadata updated', subject: 'mint' },
|
|
50
|
+
HoldingClosed: { label: 'Holding closed', subject: 'holding' },
|
|
51
|
+
DelegateSet: { label: 'Delegate set', subject: 'holding' },
|
|
52
|
+
FrozenSet: { label: 'Freeze changed', subject: 'holding' },
|
|
53
|
+
HookDataWritten: { label: 'Hook data written', subject: 'holding' },
|
|
54
|
+
// swap
|
|
55
|
+
PoolCreated: { label: 'Pool created', subject: 'pool' },
|
|
56
|
+
Swapped: { label: 'Swap', subject: 'pool' },
|
|
57
|
+
LiquidityAdded: { label: 'Liquidity added', subject: 'pool' },
|
|
58
|
+
LiquidityRemoved: { label: 'Liquidity removed', subject: 'pool' },
|
|
59
|
+
CurveFinalized: { label: 'Curve finalized', subject: 'pool' },
|
|
60
|
+
ProtocolFeesCollected: { label: 'Protocol fees collected', subject: 'pool' },
|
|
61
|
+
ConfigSet: { label: 'Config set', subject: 'admin' },
|
|
62
|
+
// launch
|
|
63
|
+
LaunchCreated: { label: 'Launch created', subject: 'mint' },
|
|
64
|
+
Graduated: { label: 'Graduated', subject: 'mint' },
|
|
65
|
+
CreatorFeesClaimed: { label: 'Creator fees claimed', subject: 'mint' },
|
|
66
|
+
LaunchConfigCreated: { label: 'Launch config created', subject: 'config' },
|
|
67
|
+
// kit
|
|
68
|
+
KitInstalled: { label: 'Rules installed', subject: 'mint' },
|
|
69
|
+
KitGraduated: { label: 'Rules graduated', subject: 'mint' },
|
|
70
|
+
RewardsClaimed: { label: 'Rewards claimed', subject: 'mint' },
|
|
71
|
+
RewardsShared: { label: 'Rewards shared', subject: 'mint' },
|
|
72
|
+
// bridge
|
|
73
|
+
WrapperRegistered: { label: 'Wrapper registered', subject: 'wrappedMint' },
|
|
74
|
+
Wrapped: { label: 'Bridged in', subject: 'wrappedMint' },
|
|
75
|
+
Unwrapped: { label: 'Bridged out', subject: 'wrappedMint' },
|
|
76
|
+
// half_life
|
|
77
|
+
Stoked: { label: 'Exit fee burned', subject: 'mint' },
|
|
78
|
+
};
|
|
79
|
+
/** An event's label in plain words; an unknown event's name with its words spaced (`SomethingNew` -> "Something new"). */
|
|
80
|
+
export function eventLabel(name) {
|
|
81
|
+
const known = EVENT_WORDS[eventName(name)];
|
|
82
|
+
if (known)
|
|
83
|
+
return known.label;
|
|
84
|
+
const spaced = eventName(name).replace(/([a-z0-9])([A-Z])/g, '$1 $2');
|
|
85
|
+
return `${spaced.charAt(0)}${spaced.slice(1).toLowerCase()}`;
|
|
86
|
+
}
|
|
87
|
+
/** The account an event is mostly about, read from its payload; null when the table names none or the payload lacks it. */
|
|
88
|
+
export function eventSubject(name, payload) {
|
|
89
|
+
const key = EVENT_WORDS[eventName(name)]?.subject;
|
|
90
|
+
if (!key)
|
|
91
|
+
return null;
|
|
92
|
+
const value = payload[key];
|
|
93
|
+
return typeof value === 'string' && value.length > 0 ? value : null;
|
|
94
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/policy.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* `programs/tests/vectors/launch-fees.json`, which the Rust tests render from the reference the
|
|
7
7
|
* programs are held to, and requires exact equality.
|
|
8
8
|
*/
|
|
9
|
-
import type { CompanionSplitBps, CompanionTemplate, GameKindName, GameRequest, GameRolloverReason, JackpotRequest, LaunchRules, LaunchRulesInput, LotteryRequest, Side, StreakRequest } from './api.ts';
|
|
9
|
+
import type { CompanionSplitBps, CompanionTemplate, GameKindName, GameRequest, GameRolloverReason, JackpotRequest, LaunchRules, LaunchRulesInput, LotteryRequest, ScriptRequest, Side, SnowballRequest, SnowballTerms, StreakRequest } from './api.ts';
|
|
10
10
|
import type { StudioGameSettings } from './studio.ts';
|
|
11
11
|
export declare const BPS = 10000n;
|
|
12
12
|
export declare const WAD: bigint;
|
|
@@ -24,6 +24,15 @@ export declare const CURVE_BPS = 7500n;
|
|
|
24
24
|
export declare const LP_FEE_BPS = 30;
|
|
25
25
|
/** Protocol fee of an ordinary DEX pool (anyone's pool), in basis points of the quote side: the flat model (§3.1). */
|
|
26
26
|
export declare const PROTOCOL_FEE_BPS = 100;
|
|
27
|
+
/**
|
|
28
|
+
* The LP fee tiers the create-pool form offers for an ordinary pool (docs/dex.md decision 2): 0.25%
|
|
29
|
+
* (the default, for bridged pairs), 1% and 2% (memecoins). The program takes any value from 0 to 90%;
|
|
30
|
+
* three tiers keep the number of duplicate pools per pair down (§3.5).
|
|
31
|
+
*/
|
|
32
|
+
export declare const POOL_FEE_TIERS_BPS: readonly [25, 100, 200];
|
|
33
|
+
export declare const POOL_FEE_TIER_DEFAULT_BPS = 25;
|
|
34
|
+
export type PoolFeeTierBps = (typeof POOL_FEE_TIERS_BPS)[number];
|
|
35
|
+
export declare const isPoolFeeTier: (bps: unknown) => bps is PoolFeeTierBps;
|
|
27
36
|
/**
|
|
28
37
|
* Bordrless's take on a launch pool (its curve and the same pool after graduation), the share
|
|
29
38
|
* model of §3.1 (2026-10-07: "we earn 25% of their total fees, not 0.25%"): a quarter of what the
|
|
@@ -35,6 +44,8 @@ export declare const PROTOCOL_FEE_BPS = 100;
|
|
|
35
44
|
export declare const LAUNCH_PROTOCOL_SHARE_BPS = 2500;
|
|
36
45
|
/** The largest share the DEX config may set (`MAX_PROTOCOL_SHARE_BPS`): all of the cuts. */
|
|
37
46
|
export declare const MAX_PROTOCOL_SHARE_BPS = 10000;
|
|
47
|
+
/** The largest flat protocol fee the DEX config may set (`bordrless_swap::constants::MAX_PROTOCOL_FEE_BPS`): 10% of the quote side. */
|
|
48
|
+
export declare const MAX_PROTOCOL_FEE_BPS = 1000;
|
|
38
49
|
/** Largest creator fee a launch may choose. */
|
|
39
50
|
export declare const MAX_CREATOR_FEE_BPS = 200;
|
|
40
51
|
/** The creator fee choices offered on the launch form. */
|
|
@@ -286,27 +297,32 @@ export declare const COMPANION_MAX_VEST_DAYS = 365;
|
|
|
286
297
|
/** The whole creator fee to the launcher: an ordinary launch, with no companion. */
|
|
287
298
|
export declare const LAUNCHER_SPLIT: Readonly<CompanionSplitBps>;
|
|
288
299
|
/**
|
|
289
|
-
* The
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
300
|
+
* The Jackpot's limits as the site offers them: the round's length (the programs take rounds from 5
|
|
301
|
+
* minutes since the five-minute rounds upgrade of 2026-10-12; the owner set the site's floor at 15
|
|
302
|
+
* minutes, which is also its default), the minimum pot, the prize's least share, a claim window's
|
|
303
|
+
* bounds (`MIN_CLAIM_WINDOW` in the companion, a minute), the most attempts, and the half of a round
|
|
304
|
+
* the attempts may take. The launch form holds its choices to them and the backend refuses anything
|
|
305
|
+
* outside them (`lotteryProblem`). `GAME_LIMITS` in the SDK is the programs' own.
|
|
293
306
|
*/
|
|
294
307
|
export declare const LOTTERY_LIMITS: {
|
|
295
|
-
readonly minRoundSecs:
|
|
308
|
+
readonly minRoundSecs: 900;
|
|
296
309
|
readonly maxRoundSecs: number;
|
|
297
310
|
readonly minMinPotLamports: 100000000n;
|
|
298
311
|
readonly maxMinPotLamports: 1000000000000n;
|
|
299
312
|
readonly minPrizeBps: 1000;
|
|
300
|
-
readonly minClaimWindowSecs:
|
|
313
|
+
readonly minClaimWindowSecs: 60;
|
|
301
314
|
readonly maxClaimWindowSecs: 86400;
|
|
302
315
|
readonly maxAttempts: 16;
|
|
303
316
|
readonly claimsPerRound: 2;
|
|
317
|
+
/** A streak's epoch and its claim window keep the programs' older floors (`MIN_EPOCH_SECS`, `MIN_EPOCH_CLAIM_WINDOW`). */
|
|
318
|
+
readonly minEpochSecs: 3600;
|
|
319
|
+
readonly minEpochClaimWindowSecs: 300;
|
|
304
320
|
/** The most a pot holds while its hook is not audited: 10 SOL, the rest of the pot's share bought back. */
|
|
305
321
|
readonly potCapLamports: 10000000000n;
|
|
306
322
|
/** Lamports the setup pays for the hook's state and registry and the game's account (mainnet rent, 2026-10-08). */
|
|
307
323
|
readonly rentLamports: bigint;
|
|
308
324
|
};
|
|
309
|
-
/** The lottery the launch form starts with (
|
|
325
|
+
/** The lottery the launch form starts with (the owner, 2026-10-12): 15-minute rounds, 70% of the fee to the pot, 30% bought back, draws from 0.5 SOL paying the whole pot, 3 claim attempts of 2 minutes (`lotteryClaimsFor`). */
|
|
310
326
|
export declare const LOTTERY_DEFAULTS: Readonly<LotteryRequest>;
|
|
311
327
|
/** The round lengths the form offers (seconds), each with its label. */
|
|
312
328
|
export declare const LOTTERY_ROUND_CHOICES: readonly {
|
|
@@ -323,8 +339,10 @@ export declare const LOTTERY_PRIZE_CHOICES_BPS: readonly [10000, 5000, 2500];
|
|
|
323
339
|
/** The pot's share moves in steps of 10%, like the Split control's. */
|
|
324
340
|
export declare const LOTTERY_POT_STEP_BPS = 1000;
|
|
325
341
|
/**
|
|
326
|
-
* The claim windows and attempts the form fixes for a round length
|
|
327
|
-
* round of 6 hours
|
|
342
|
+
* The claim windows and attempts the form fixes for a round length (the attempts must fit in half a
|
|
343
|
+
* round, `claimsPerRound`): 8 attempts of 10 minutes from 6 hours, 6 of 5 minutes from an hour, 3 of
|
|
344
|
+
* 2 minutes from 15 minutes, and 2 of a minute under that (the programs' 5-minute rounds, which the
|
|
345
|
+
* site does not offer).
|
|
328
346
|
*/
|
|
329
347
|
export declare function lotteryClaimsFor(roundSecs: number): {
|
|
330
348
|
claimWindowSecs: number;
|
|
@@ -342,11 +360,11 @@ export declare function lotteryRequestOf(raw: unknown): LotteryRequest | null;
|
|
|
342
360
|
export declare function lotteryProblem(game: LotteryRequest, split: CompanionSplitBps, rules: LaunchRulesInput, creatorFeeBps: number): string | null;
|
|
343
361
|
/** The copy rules of a lottery coin (docs/games.md): said on the launch form, the review step and the token page, never "provably fair", "guaranteed" or "audited". */
|
|
344
362
|
export declare const LOTTERY_COPY: {
|
|
345
|
-
readonly held: "The pot is held by
|
|
346
|
-
readonly odds: "Your odds
|
|
347
|
-
readonly stop: "Bordrless can stop
|
|
348
|
-
readonly cap: "
|
|
349
|
-
readonly oracle: "
|
|
363
|
+
readonly held: "The pot is held by code, not by a person. Each round, one holder is picked at random and paid in SOL.";
|
|
364
|
+
readonly odds: "Your odds are your share of the tokens held through the round. Tokens you buy count from the next round, and selling during a round takes you out of it.";
|
|
365
|
+
readonly stop: "Bordrless can stop the game. If it does, the pot buys back and burns the token and no one is paid.";
|
|
366
|
+
readonly cap: "The pot holds at most 10 SOL for now. Anything above that buys back and burns the token.";
|
|
367
|
+
readonly oracle: "The random numbers come from ORAO, an outside service. Neither Bordrless nor the launcher can pick the winner.";
|
|
350
368
|
};
|
|
351
369
|
/** The jackpot's timer and the streak's minimum streak: the companion's bounds (`GAME_LIMITS` in the SDK). */
|
|
352
370
|
export declare const GAME_KIND_LIMITS: {
|
|
@@ -383,20 +401,20 @@ export declare const GAME_KIND_NAMES: Readonly<Record<GameKindName, string>>;
|
|
|
383
401
|
* stop this game"; never "provably fair", "guaranteed" or "audited".
|
|
384
402
|
*/
|
|
385
403
|
export declare const JACKPOT_COPY: {
|
|
386
|
-
readonly held: "The pot is held by
|
|
387
|
-
readonly rule: "The last buyer wins
|
|
388
|
-
readonly unfunded: "If the pot is
|
|
389
|
-
readonly curve: "
|
|
390
|
-
readonly cap: "
|
|
391
|
-
readonly stop: "Bordrless can stop
|
|
404
|
+
readonly held: "The pot is held by code, not by a person. No luck involved: the last buyer wins.";
|
|
405
|
+
readonly rule: "The last buyer wins when the timer runs out, as long as they still hold what they bought. Selling or sending any of it forfeits.";
|
|
406
|
+
readonly unfunded: "If the pot is under its minimum when the timer runs out, no prize is paid and the pot keeps growing.";
|
|
407
|
+
readonly curve: "The game runs while the coin is on its curve and ends at graduation. A round under way is still paid.";
|
|
408
|
+
readonly cap: "The pot holds at most 10 SOL for now. Anything above that buys back and burns the token.";
|
|
409
|
+
readonly stop: "Bordrless can stop the game. If it does, the pot buys back and burns the token and no one is paid.";
|
|
392
410
|
};
|
|
393
411
|
export declare const STREAK_COPY: {
|
|
394
|
-
readonly held: "The pot is held by
|
|
395
|
-
readonly rule: "
|
|
396
|
-
readonly weight: "Your
|
|
397
|
-
readonly claims: "Shares are
|
|
398
|
-
readonly cap: "
|
|
399
|
-
readonly stop: "Bordrless can stop
|
|
412
|
+
readonly held: "The pot is held by code, not by a person. No luck involved: holders share it in proportion to what they held.";
|
|
413
|
+
readonly rule: "Hold through the epoch without sending anything. Any sale or transfer drops you out of this epoch and the last one.";
|
|
414
|
+
readonly weight: "Your share is based on what you held when the epoch began. Tokens you buy during an epoch count from the next one.";
|
|
415
|
+
readonly claims: "Shares are paid out during the next epoch. Most are paid automatically; small ones are claimed here. Unclaimed shares stay in the pot.";
|
|
416
|
+
readonly cap: "The pot holds at most 10 SOL for now. Anything above that buys back and burns the token.";
|
|
417
|
+
readonly stop: "Bordrless can stop the game. If it does, the pot buys back and burns the token and no one is paid.";
|
|
400
418
|
};
|
|
401
419
|
/** Why a round paid no prize, in a few words each (`GameRolloverReason`). */
|
|
402
420
|
export declare const ROLLOVER_WORDS: Readonly<Record<GameRolloverReason, string>>;
|
|
@@ -422,6 +440,61 @@ export declare function companionRequestSplit(raw: unknown): CompanionSplitBps |
|
|
|
422
440
|
* `CreatorLockUnsupported`, `HolderRewardsOff`), and a creator fee for it to run.
|
|
423
441
|
*/
|
|
424
442
|
export declare function companionSplitProblem(split: CompanionSplitBps, rules: Pick<LaunchRulesInput, 'holderFeeBuyBps' | 'holderFeeSellBps' | 'creatorLockDays'>, creatorFeeBps: number): string | null;
|
|
443
|
+
/** The presets the launch form offers. Every one spends the pot on volume and trades even when the price is flat; they differ in how fast and how big. */
|
|
444
|
+
export type SnowballPreset = 'conservative' | 'normal' | 'aggressive';
|
|
445
|
+
export declare const SNOWBALL_PRESETS: Readonly<Record<SnowballPreset, Readonly<SnowballTerms>>>;
|
|
446
|
+
export declare const SNOWBALL_PRESET_LIST: readonly SnowballPreset[];
|
|
447
|
+
export declare const SNOWBALL_DEFAULT_PRESET: SnowballPreset;
|
|
448
|
+
/** The custom controls' choices. The program takes anything within `SNOWBALL_BOUNDS`. */
|
|
449
|
+
export declare const SNOWBALL_STEP_CHOICES_BPS: readonly [50, 100, 200, 300, 500, 1000];
|
|
450
|
+
export declare const SNOWBALL_SIZE_CHOICES_BPS: readonly [1000, 2500, 5000, 7500, 10000];
|
|
451
|
+
export declare const SNOWBALL_POOL_CHOICES_BPS: readonly [100, 200, 500, 1000];
|
|
452
|
+
export declare const SNOWBALL_INTERVAL_CHOICES_SECS: readonly [10, 30, 60, 300];
|
|
453
|
+
/** The program's bounds (`create_snowball`). */
|
|
454
|
+
export declare const SNOWBALL_BOUNDS: {
|
|
455
|
+
readonly minStepBps: 50;
|
|
456
|
+
readonly maxStepBps: 2000;
|
|
457
|
+
readonly minSizeBps: 100;
|
|
458
|
+
readonly maxSizeBps: 10000;
|
|
459
|
+
readonly minPoolBps: 25;
|
|
460
|
+
readonly maxPoolBps: 1000;
|
|
461
|
+
readonly minInterval: 10;
|
|
462
|
+
readonly maxInterval: 86400;
|
|
463
|
+
};
|
|
464
|
+
/** The Snowball a launch request's `companion` names; null without one; `'malformed'` when it is there and not whole numbers and a flag. */
|
|
465
|
+
export declare function snowballRequestOf(companion: unknown): SnowballRequest | null | 'malformed';
|
|
466
|
+
/**
|
|
467
|
+
* Why a Snowball with this split can't run these rules at this fee, in the words the launch form and
|
|
468
|
+
* the backend use (`companion_rules`); null when it can: the market maker's part with the split adds up
|
|
469
|
+
* to 10,000, its terms are within the program's bounds, and what any companion needs
|
|
470
|
+
* (`companionSplitProblem`'s rules).
|
|
471
|
+
*/
|
|
472
|
+
export declare function snowballProblem(s: SnowballRequest, split: CompanionSplitBps, rules: Pick<LaunchRulesInput, 'holderFeeBuyBps' | 'holderFeeSellBps' | 'creatorLockDays'>, creatorFeeBps: number): string | null;
|
|
473
|
+
/** The companion program's script bounds (`create_script`): steps 10 seconds to a day apart, at most 512 bytes of init data, at most 10,240 bytes of state. */
|
|
474
|
+
export declare const SCRIPT_BOUNDS: {
|
|
475
|
+
readonly minInterval: 10;
|
|
476
|
+
readonly maxInterval: 86400;
|
|
477
|
+
readonly maxInitLen: 512;
|
|
478
|
+
readonly maxStateLen: 10240;
|
|
479
|
+
};
|
|
480
|
+
/** The interval choices the launch form offers (seconds): a minute, five, fifteen, an hour, a day. */
|
|
481
|
+
export declare const SCRIPT_INTERVAL_CHOICES_SECS: readonly [60, 300, 900, 3600, 86400];
|
|
482
|
+
/**
|
|
483
|
+
* How many bytes a script's init data holds, as the request writes it: hex (an even number of hex
|
|
484
|
+
* digits, `0x` or not) or base64; the empty string is no data. Null when it is neither. Hex is tried
|
|
485
|
+
* first: a text that reads as both (`abcd`) is read as hex.
|
|
486
|
+
*/
|
|
487
|
+
export declare function scriptInitDataLength(raw: string): number | null;
|
|
488
|
+
/** The custom companion's script a launch request's `companion` names; null without one; `'malformed'` when it is there and not the fields `ScriptRequest` takes. */
|
|
489
|
+
export declare function scriptRequestOf(companion: unknown): ScriptRequest | null | 'malformed';
|
|
490
|
+
/**
|
|
491
|
+
* Why a custom companion with this split can't run these rules at this fee, in the words the launch
|
|
492
|
+
* form and the backend use (`companion_rules`); null when it can: the pot's part with the split adds
|
|
493
|
+
* up to 10,000, the interval, the init data and the state are within the program's bounds, and what
|
|
494
|
+
* any companion needs (`companionSplitProblem`'s rules). Whether the script is approved is the
|
|
495
|
+
* backend's to check (`script_not_approved`).
|
|
496
|
+
*/
|
|
497
|
+
export declare function scriptProblem(s: ScriptRequest, split: CompanionSplitBps, rules: Pick<LaunchRulesInput, 'holderFeeBuyBps' | 'holderFeeSellBps' | 'creatorLockDays'>, creatorFeeBps: number): string | null;
|
|
425
498
|
/** The template whose split this is, or null for any other split. */
|
|
426
499
|
export declare function companionTemplateOf(split: CompanionSplitBps): CompanionTemplate | null;
|
|
427
500
|
/** Kit module bits (§4.2). */
|