@aephia/atlas-kit 0.8.0-next.9 → 0.8.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 +1 -1
- package/dist/claim-stakes/actions/index.d.ts +153 -0
- package/dist/claim-stakes/actions/index.d.ts.map +1 -1
- package/dist/claim-stakes/actions/index.js +560 -72
- package/dist/claim-stakes/actions/index.js.map +1 -1
- package/dist/claim-stakes/index.d.ts +1 -1
- package/dist/claim-stakes/index.d.ts.map +1 -1
- package/dist/claim-stakes/index.js +1 -1
- package/dist/claim-stakes/index.js.map +1 -1
- package/dist/client/contracts.d.ts +1 -1
- package/dist/client/contracts.d.ts.map +1 -1
- package/dist/client/deployments.d.ts +1 -1
- package/dist/client/deployments.js +1 -1
- package/dist/client/errors.d.ts +1 -1
- package/dist/client/errors.d.ts.map +1 -1
- package/dist/client/errors.js.map +1 -1
- package/dist/combat/actions/index.d.ts +137 -0
- package/dist/combat/actions/index.d.ts.map +1 -1
- package/dist/combat/actions/index.js +596 -1
- package/dist/combat/actions/index.js.map +1 -1
- package/dist/crafting/actions/habs.d.ts +366 -0
- package/dist/crafting/actions/habs.d.ts.map +1 -0
- package/dist/crafting/actions/habs.js +1030 -0
- package/dist/crafting/actions/habs.js.map +1 -0
- package/dist/crafting/actions/index.d.ts +14 -3
- package/dist/crafting/actions/index.d.ts.map +1 -1
- package/dist/crafting/actions/index.js +61 -25
- package/dist/crafting/actions/index.js.map +1 -1
- package/dist/crafting/index.d.ts +4 -1
- package/dist/crafting/index.d.ts.map +1 -1
- package/dist/crafting/index.js +1 -1
- package/dist/crafting/index.js.map +1 -1
- package/dist/fleets/actions/index.d.ts +10 -8
- package/dist/fleets/actions/index.d.ts.map +1 -1
- package/dist/fleets/actions/index.js +15 -13
- package/dist/fleets/actions/index.js.map +1 -1
- package/dist/identity/actions/daily-check-in.d.ts +57 -0
- package/dist/identity/actions/daily-check-in.d.ts.map +1 -0
- package/dist/identity/actions/daily-check-in.js +200 -0
- package/dist/identity/actions/daily-check-in.js.map +1 -0
- package/dist/identity/actions/index.d.ts +1 -0
- package/dist/identity/actions/index.d.ts.map +1 -1
- package/dist/identity/actions/index.js +1 -0
- package/dist/identity/actions/index.js.map +1 -1
- package/dist/identity/index.d.ts +169 -17
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/identity/index.js +142 -9
- package/dist/identity/index.js.map +1 -1
- package/dist/internal/c4/career-xp.d.ts +113 -26
- package/dist/internal/c4/career-xp.d.ts.map +1 -1
- package/dist/internal/c4/career-xp.js +101 -38
- package/dist/internal/c4/career-xp.js.map +1 -1
- package/dist/internal/c4/character-registration.d.ts.map +1 -1
- package/dist/internal/c4/character-registration.js +3 -0
- package/dist/internal/c4/character-registration.js.map +1 -1
- package/dist/internal/c4/character.d.ts +68 -0
- package/dist/internal/c4/character.d.ts.map +1 -1
- package/dist/internal/c4/character.js +46 -2
- package/dist/internal/c4/character.js.map +1 -1
- package/dist/internal/c4/claim-stake.d.ts +8 -0
- package/dist/internal/c4/claim-stake.d.ts.map +1 -1
- package/dist/internal/c4/claim-stake.js +5 -0
- package/dist/internal/c4/claim-stake.js.map +1 -1
- package/dist/internal/c4/combat-storage.d.ts +4 -0
- package/dist/internal/c4/combat-storage.d.ts.map +1 -1
- package/dist/internal/c4/combat-storage.js +6 -1
- package/dist/internal/c4/combat-storage.js.map +1 -1
- package/dist/internal/c4/crafting-hab-storage.d.ts +42 -0
- package/dist/internal/c4/crafting-hab-storage.d.ts.map +1 -0
- package/dist/internal/c4/crafting-hab-storage.js +174 -0
- package/dist/internal/c4/crafting-hab-storage.js.map +1 -0
- package/dist/internal/c4/crafting-storage.d.ts +8 -0
- package/dist/internal/c4/crafting-storage.d.ts.map +1 -1
- package/dist/internal/c4/crafting-storage.js +18 -1
- package/dist/internal/c4/crafting-storage.js.map +1 -1
- package/dist/internal/c4/crafting.d.ts +8 -0
- package/dist/internal/c4/crafting.d.ts.map +1 -1
- package/dist/internal/c4/crafting.js +5 -0
- package/dist/internal/c4/crafting.js.map +1 -1
- package/dist/internal/c4/discriminators.d.ts +27 -0
- package/dist/internal/c4/discriminators.d.ts.map +1 -1
- package/dist/internal/c4/discriminators.js +55 -1
- package/dist/internal/c4/discriminators.js.map +1 -1
- package/dist/internal/c4/fleet-storage.d.ts +2 -1
- package/dist/internal/c4/fleet-storage.d.ts.map +1 -1
- package/dist/internal/c4/fleet-storage.js +14 -5
- package/dist/internal/c4/fleet-storage.js.map +1 -1
- package/dist/internal/c4/fleet.d.ts +33 -4
- package/dist/internal/c4/fleet.d.ts.map +1 -1
- package/dist/internal/c4/fleet.js +27 -2
- package/dist/internal/c4/fleet.js.map +1 -1
- package/dist/internal/c4/game.d.ts +33 -0
- package/dist/internal/c4/game.d.ts.map +1 -1
- package/dist/internal/c4/game.js +46 -0
- package/dist/internal/c4/game.js.map +1 -1
- package/dist/internal/c4/governance.d.ts +72 -0
- package/dist/internal/c4/governance.d.ts.map +1 -1
- package/dist/internal/c4/governance.js +108 -3
- package/dist/internal/c4/governance.js.map +1 -1
- package/dist/internal/c4/runtime-bindings.d.ts +1 -1
- package/dist/internal/c4/runtime-bindings.d.ts.map +1 -1
- package/dist/internal/c4/runtime-bindings.js +1 -1
- package/dist/internal/c4/runtime-bindings.js.map +1 -1
- package/dist/internal/c4/starbase-upgrade.d.ts +20 -0
- package/dist/internal/c4/starbase-upgrade.d.ts.map +1 -0
- package/dist/internal/c4/starbase-upgrade.js +44 -0
- package/dist/internal/c4/starbase-upgrade.js.map +1 -0
- package/dist/internal/c4/world.d.ts +3 -2
- package/dist/internal/c4/world.d.ts.map +1 -1
- package/dist/internal/c4/world.js +4 -18
- package/dist/internal/c4/world.js.map +1 -1
- package/dist/internal/planning/action-runtime.d.ts +3 -2
- package/dist/internal/planning/action-runtime.d.ts.map +1 -1
- package/dist/internal/planning/action-runtime.js +4 -3
- package/dist/internal/planning/action-runtime.js.map +1 -1
- package/dist/internal/planning/authorization-adapter.d.ts +363 -1
- package/dist/internal/planning/authorization-adapter.d.ts.map +1 -1
- package/dist/internal/planning/authorization-adapter.js +519 -1
- package/dist/internal/planning/authorization-adapter.js.map +1 -1
- package/dist/internal/planning/building-xp.d.ts +50 -0
- package/dist/internal/planning/building-xp.d.ts.map +1 -0
- package/dist/internal/planning/building-xp.js +166 -0
- package/dist/internal/planning/building-xp.js.map +1 -0
- package/dist/internal/planning/claim-stake-transfer-window.d.ts +18 -0
- package/dist/internal/planning/claim-stake-transfer-window.d.ts.map +1 -0
- package/dist/internal/planning/claim-stake-transfer-window.js +57 -0
- package/dist/internal/planning/claim-stake-transfer-window.js.map +1 -0
- package/dist/internal/planning/combat-storage-actions.d.ts +3 -2
- package/dist/internal/planning/combat-storage-actions.d.ts.map +1 -1
- package/dist/internal/planning/combat-storage-actions.js +26 -4
- package/dist/internal/planning/combat-storage-actions.js.map +1 -1
- package/dist/internal/planning/crafting-hab-storage-actions.d.ts +10 -0
- package/dist/internal/planning/crafting-hab-storage-actions.d.ts.map +1 -0
- package/dist/internal/planning/crafting-hab-storage-actions.js +46 -0
- package/dist/internal/planning/crafting-hab-storage-actions.js.map +1 -0
- package/dist/internal/planning/crafting-storage-actions.d.ts +5 -3
- package/dist/internal/planning/crafting-storage-actions.d.ts.map +1 -1
- package/dist/internal/planning/crafting-storage-actions.js +66 -4
- package/dist/internal/planning/crafting-storage-actions.js.map +1 -1
- package/dist/internal/planning/currency-cache-guard.d.ts.map +1 -1
- package/dist/internal/planning/currency-cache-guard.js +5 -1
- package/dist/internal/planning/currency-cache-guard.js.map +1 -1
- package/dist/internal/planning/daily-check-in.d.ts +71 -0
- package/dist/internal/planning/daily-check-in.d.ts.map +1 -0
- package/dist/internal/planning/daily-check-in.js +201 -0
- package/dist/internal/planning/daily-check-in.js.map +1 -0
- package/dist/internal/planning/democracy-history.d.ts +15 -0
- package/dist/internal/planning/democracy-history.d.ts.map +1 -1
- package/dist/internal/planning/democracy-history.js +23 -7
- package/dist/internal/planning/democracy-history.js.map +1 -1
- package/dist/internal/planning/democracy-storage-actions.d.ts +12 -0
- package/dist/internal/planning/democracy-storage-actions.d.ts.map +1 -0
- package/dist/internal/planning/democracy-storage-actions.js +81 -0
- package/dist/internal/planning/democracy-storage-actions.js.map +1 -0
- package/dist/internal/planning/fleet-state.js +1 -1
- package/dist/internal/planning/fleet-state.js.map +1 -1
- package/dist/internal/planning/loyalty-earning.d.ts +42 -0
- package/dist/internal/planning/loyalty-earning.d.ts.map +1 -0
- package/dist/internal/planning/loyalty-earning.js +143 -0
- package/dist/internal/planning/loyalty-earning.js.map +1 -0
- package/dist/internal/planning/placement-fee.d.ts +6 -0
- package/dist/internal/planning/placement-fee.d.ts.map +1 -0
- package/dist/internal/planning/placement-fee.js +9 -0
- package/dist/internal/planning/placement-fee.js.map +1 -0
- package/dist/internal/planning/plan-guards.d.ts.map +1 -1
- package/dist/internal/planning/plan-guards.js +11 -0
- package/dist/internal/planning/plan-guards.js.map +1 -1
- package/dist/internal/planning/profile-storage-funding-guard.d.ts +1 -1
- package/dist/internal/planning/profile-storage-funding-guard.d.ts.map +1 -1
- package/dist/internal/planning/profile-storage-funding-guard.js +53 -1
- package/dist/internal/planning/profile-storage-funding-guard.js.map +1 -1
- package/dist/internal/planning/rent-catalog.d.ts.map +1 -1
- package/dist/internal/planning/rent-catalog.js +37 -1
- package/dist/internal/planning/rent-catalog.js.map +1 -1
- package/dist/internal/planning/research-unlock.d.ts.map +1 -1
- package/dist/internal/planning/research-unlock.js.map +1 -1
- package/dist/internal/planning/reward-epoch.d.ts +44 -0
- package/dist/internal/planning/reward-epoch.d.ts.map +1 -0
- package/dist/internal/planning/reward-epoch.js +220 -0
- package/dist/internal/planning/reward-epoch.js.map +1 -0
- package/dist/internal/planning/runtime-guards.d.ts.map +1 -1
- package/dist/internal/planning/runtime-guards.js +92 -13
- package/dist/internal/planning/runtime-guards.js.map +1 -1
- package/dist/internal/planning/starbase-repair-guard.d.ts +12 -0
- package/dist/internal/planning/starbase-repair-guard.d.ts.map +1 -0
- package/dist/internal/planning/starbase-repair-guard.js +54 -0
- package/dist/internal/planning/starbase-repair-guard.js.map +1 -0
- package/dist/internal/planning/starbase-system-guard.d.ts.map +1 -1
- package/dist/internal/planning/starbase-system-guard.js +48 -3
- package/dist/internal/planning/starbase-system-guard.js.map +1 -1
- package/dist/internal/planning/starbase-upgrade-storage-actions.d.ts +7 -0
- package/dist/internal/planning/starbase-upgrade-storage-actions.d.ts.map +1 -0
- package/dist/internal/planning/starbase-upgrade-storage-actions.js +71 -0
- package/dist/internal/planning/starbase-upgrade-storage-actions.js.map +1 -0
- package/dist/internal/planning/starbase-upgrade-window.d.ts +22 -0
- package/dist/internal/planning/starbase-upgrade-window.d.ts.map +1 -0
- package/dist/internal/planning/starbase-upgrade-window.js +64 -0
- package/dist/internal/planning/starbase-upgrade-window.js.map +1 -0
- package/dist/internal/planning/storage-action-readers.d.ts.map +1 -1
- package/dist/internal/planning/storage-action-readers.js +36 -3
- package/dist/internal/planning/storage-action-readers.js.map +1 -1
- package/dist/internal/planning/storage-actions.d.ts +5 -1
- package/dist/internal/planning/storage-actions.d.ts.map +1 -1
- package/dist/internal/planning/storage-actions.js +8 -1
- package/dist/internal/planning/storage-actions.js.map +1 -1
- package/dist/mining/actions/index.js +1 -1
- package/dist/mining/actions/index.js.map +1 -1
- package/dist/planning/assembly.d.ts +2 -0
- package/dist/planning/assembly.d.ts.map +1 -1
- package/dist/planning/assembly.js +5 -1
- package/dist/planning/assembly.js.map +1 -1
- package/dist/planning/execution.d.ts.map +1 -1
- package/dist/planning/execution.js +132 -5
- package/dist/planning/execution.js.map +1 -1
- package/dist/planning/index.d.ts +75 -0
- package/dist/planning/index.d.ts.map +1 -1
- package/dist/planning/index.js +1 -0
- package/dist/planning/index.js.map +1 -1
- package/dist/planning/plan-validation.d.ts.map +1 -1
- package/dist/planning/plan-validation.js +27 -0
- package/dist/planning/plan-validation.js.map +1 -1
- package/dist/planning/selected-references.d.ts +83 -1
- package/dist/planning/selected-references.d.ts.map +1 -1
- package/dist/planning/selected-references.js +192 -2
- package/dist/planning/selected-references.js.map +1 -1
- package/dist/planning/simulation.d.ts.map +1 -1
- package/dist/planning/simulation.js +11 -3
- package/dist/planning/simulation.js.map +1 -1
- package/dist/starbases/actions/democracy.d.ts +205 -0
- package/dist/starbases/actions/democracy.d.ts.map +1 -0
- package/dist/starbases/actions/democracy.js +861 -0
- package/dist/starbases/actions/democracy.js.map +1 -0
- package/dist/starbases/actions/index.d.ts +2 -0
- package/dist/starbases/actions/index.d.ts.map +1 -1
- package/dist/starbases/actions/index.js +2 -0
- package/dist/starbases/actions/index.js.map +1 -1
- package/dist/starbases/actions/upgrades.d.ts +116 -0
- package/dist/starbases/actions/upgrades.d.ts.map +1 -0
- package/dist/starbases/actions/upgrades.js +474 -0
- package/dist/starbases/actions/upgrades.js.map +1 -0
- package/dist/starbases/governance.d.ts +75 -0
- package/dist/starbases/governance.d.ts.map +1 -1
- package/dist/starbases/governance.js +82 -1
- package/dist/starbases/governance.js.map +1 -1
- package/dist/starbases/index.d.ts +1 -1
- package/dist/starbases/index.d.ts.map +1 -1
- package/dist/starbases/index.js +1 -1
- package/dist/starbases/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import { isAddress } from '@solana/kit';
|
|
2
|
+
import { InvalidActionInputError, SageSdkError } from '../../client/errors.js';
|
|
3
|
+
import { readContextRawAccounts } from '../../client/reconciliation.js';
|
|
4
|
+
import { findCharacterPda } from '../../internal/c4/character.js';
|
|
5
|
+
import { factionValue } from '../../internal/c4/faction.js';
|
|
6
|
+
import { deriveFactionOwnershipAddress, deriveKingSystemTrackerAddress, deriveRegionTrackerAddress, } from '../../internal/c4/factions.js';
|
|
7
|
+
import { deriveStarbasePlayerAddress, starbasePlayerAccountDefinition, starbaseUpgradeProcessAccountDefinition, } from '../../internal/c4/starbase.js';
|
|
8
|
+
import { currentUpgradeMaterials, installableUpgradeQuantity, } from '../../internal/c4/starbase-upgrade.js';
|
|
9
|
+
import { deriveStarSystemAddress, starSystemAccountDefinition, } from '../../internal/c4/world.js';
|
|
10
|
+
import { requireGameAddress } from '../../internal/game-context.js';
|
|
11
|
+
import { accountAbsentPrecondition, accountStatePrecondition, } from '../../internal/planning/account-state.js';
|
|
12
|
+
import { resolveDemocracyHistory } from '../../internal/planning/democracy-history.js';
|
|
13
|
+
import { adaptCancelStarbaseUpgradeContributionInstruction, adaptContributeToStarbaseUpgradeInstruction, adaptInstallStarbaseUpgradeResourceInstruction, readPlanAuthorization, } from '../../internal/planning/authorization-adapter.js';
|
|
14
|
+
import { CLOCK_ADDRESS, readClock, } from '../../internal/planning/faction-enrollment.js';
|
|
15
|
+
import { resolveLoyaltyEarning, resolveRewardContext, } from '../../internal/planning/loyalty-earning.js';
|
|
16
|
+
import { requireDisabledLevelRent } from '../../internal/planning/rent-catalog.js';
|
|
17
|
+
import { RENT_ADDRESS } from '../../internal/planning/rent.js';
|
|
18
|
+
import { readStarbaseUpgradeStorageAction } from '../../internal/planning/starbase-upgrade-storage-actions.js';
|
|
19
|
+
import { planStorageFunding } from '../../internal/planning/storage-actions.js';
|
|
20
|
+
import { buildPlannerPlan } from '../../planning/plan-construction.js';
|
|
21
|
+
const U16_MAX = 65_535;
|
|
22
|
+
const U64_MAX = 18446744073709551615n;
|
|
23
|
+
function fail(message, address) {
|
|
24
|
+
throw new SageSdkError('ACTION_PRECONDITION_FAILED', message, { address });
|
|
25
|
+
}
|
|
26
|
+
function invalid(field, value, accepted, remedy) {
|
|
27
|
+
throw new InvalidActionInputError(field, value, accepted, remedy);
|
|
28
|
+
}
|
|
29
|
+
function readOptions(value, required) {
|
|
30
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
31
|
+
return invalid('options', value, 'a plain object', 'Provide the documented options object before retrying.');
|
|
32
|
+
const options = value;
|
|
33
|
+
const missing = required.find((key) => !Object.hasOwn(options, key));
|
|
34
|
+
const unexpected = Object.keys(options).find((key) => !required.includes(key));
|
|
35
|
+
if (missing !== undefined || unexpected !== undefined)
|
|
36
|
+
invalid('options', missing === undefined ? unexpected : `missing ${missing}`, `exactly the fields ${required.join(', ')}`, 'Remove unknown fields and provide every required option before retrying.');
|
|
37
|
+
return options;
|
|
38
|
+
}
|
|
39
|
+
function present(account, address, message) {
|
|
40
|
+
return account ?? fail(message, address);
|
|
41
|
+
}
|
|
42
|
+
/** Decodes the fresh Star System and requires its current Starbase in the
|
|
43
|
+
* configured Game at `sequenceId`. */
|
|
44
|
+
async function readStarbaseSystem(ctx, game, raw, sequenceId, staleRemedy) {
|
|
45
|
+
const system = starSystemAccountDefinition.decode(raw, ctx.programs);
|
|
46
|
+
if (system.game !== game ||
|
|
47
|
+
(await deriveStarSystemAddress(ctx.programs, game, system.systemId)) !==
|
|
48
|
+
raw.address)
|
|
49
|
+
fail(`Star System ${raw.address} is not the canonical System of its id in configured Game ${game}. Refresh it through this context and retry.`, raw.address);
|
|
50
|
+
if (system.starbase === undefined)
|
|
51
|
+
fail(`Star System ${system.name} (${raw.address}) has no Starbase. Choose a System with a Starbase and retry.`, raw.address);
|
|
52
|
+
if (system.sequenceId !== sequenceId)
|
|
53
|
+
fail(`The Starbase at Star System ${system.name} (${raw.address}) is at sequence ${String(system.sequenceId)}, not ${String(sequenceId)}: it was destroyed or replaced. ${staleRemedy}`, raw.address);
|
|
54
|
+
return system;
|
|
55
|
+
}
|
|
56
|
+
function starbaseSystemGuard(system, game, sequenceId) {
|
|
57
|
+
return {
|
|
58
|
+
kind: 'starbase-system',
|
|
59
|
+
address: system,
|
|
60
|
+
game,
|
|
61
|
+
starbaseSequenceId: sequenceId,
|
|
62
|
+
describes: `Star System ${system} retains its canonical Game identity, active Starbase and sequence ${String(sequenceId)}; unrelated shared activity may change.`,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/** The game's contribution time: the material's base duration per unit of
|
|
66
|
+
* crew, rounded up, and never less than the base duration. */
|
|
67
|
+
function contributionSeconds(baseSeconds, quantity, crew) {
|
|
68
|
+
const base = BigInt(baseSeconds);
|
|
69
|
+
const scaled = (base * quantity + BigInt(crew) - 1n) / BigInt(crew);
|
|
70
|
+
return scaled > base ? scaled : base;
|
|
71
|
+
}
|
|
72
|
+
/** Plans one Starbase upgrade contribution: one material and idle crew from a
|
|
73
|
+
* Starbase Player go into a new StarbaseUpgradeProcess, which can be installed
|
|
74
|
+
* once its time has passed.
|
|
75
|
+
*
|
|
76
|
+
* The planner requires a Starbase below its maximum level whose current
|
|
77
|
+
* upgrade still needs the material, refuses more than the Starbase still
|
|
78
|
+
* needs, fewer crew than the material requires or than are idle, and cargo the
|
|
79
|
+
* Starbase Player does not hold. Running contributions reserve nothing: the
|
|
80
|
+
* game counts only installed material, and returns at installation whatever
|
|
81
|
+
* the Starbase no longer needs. Key permissions and research access to the
|
|
82
|
+
* material remain chain-authoritative.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* declare const ctx: SageContext;
|
|
87
|
+
* declare const player: StarbasePlayerSnapshot;
|
|
88
|
+
* declare const options: PlanContributeToStarbaseUpgradeOptions;
|
|
89
|
+
* const plan = await planContributeToStarbaseUpgrade(ctx, player, options);
|
|
90
|
+
* console.log(plan.describe());
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export async function planContributeToStarbaseUpgrade(ctx, starbasePlayer, input) {
|
|
94
|
+
const options = readOptions(input, [
|
|
95
|
+
'authorization',
|
|
96
|
+
'upgradeProcess',
|
|
97
|
+
'cargoId',
|
|
98
|
+
'quantity',
|
|
99
|
+
'crew',
|
|
100
|
+
]);
|
|
101
|
+
const authorization = readPlanAuthorization(options.authorization);
|
|
102
|
+
const { upgradeProcess, cargoId, quantity, crew } = options;
|
|
103
|
+
if (typeof upgradeProcess !== 'string' || !isAddress(upgradeProcess))
|
|
104
|
+
invalid('upgradeProcess', upgradeProcess, 'one valid z.ink/Solana account address', 'Generate a new signer for the StarbaseUpgradeProcess and pass its address before retrying.');
|
|
105
|
+
if (!Number.isSafeInteger(cargoId) ||
|
|
106
|
+
cargoId < 0 ||
|
|
107
|
+
cargoId > U16_MAX)
|
|
108
|
+
invalid('cargoId', cargoId, 'a cargo id from the Starbase upgrade materials', 'Choose one of the materials the Starbase still needs before retrying.');
|
|
109
|
+
if (typeof quantity !== 'bigint' || quantity <= 0n || quantity > U64_MAX)
|
|
110
|
+
invalid('quantity', quantity, 'a positive u64 bigint', 'Provide the number of raw units to contribute before retrying.');
|
|
111
|
+
if (!Number.isSafeInteger(crew) ||
|
|
112
|
+
crew < 1 ||
|
|
113
|
+
crew > U16_MAX)
|
|
114
|
+
invalid('crew', crew, 'a positive integer of at most 65,535', 'Assign at least the crew the material requires before retrying.');
|
|
115
|
+
const amount = quantity;
|
|
116
|
+
const crewCount = crew;
|
|
117
|
+
const material = cargoId;
|
|
118
|
+
if (upgradeProcess === authorization.authority)
|
|
119
|
+
invalid('upgradeProcess', upgradeProcess, 'a new signer address other than the authorization key', 'Generate a new signer for the StarbaseUpgradeProcess before retrying.');
|
|
120
|
+
const game = requireGameAddress(ctx);
|
|
121
|
+
const { profile } = authorization;
|
|
122
|
+
if (starbasePlayer.playerProfile.address !== profile)
|
|
123
|
+
fail(`Starbase Player ${starbasePlayer.address} belongs to Profile ${starbasePlayer.playerProfile.address}, not authorization Profile ${profile}. Use the owning Profile and retry.`, starbasePlayer.address);
|
|
124
|
+
const system = starbasePlayer.system.address;
|
|
125
|
+
const character = await findCharacterPda(ctx.programs, profile, game);
|
|
126
|
+
const [systemCandidate, playerCandidate, profileCandidate, characterCandidate, processCandidate, rent,] = await readContextRawAccounts(ctx, [
|
|
127
|
+
system,
|
|
128
|
+
starbasePlayer.address,
|
|
129
|
+
profile,
|
|
130
|
+
character,
|
|
131
|
+
upgradeProcess,
|
|
132
|
+
RENT_ADDRESS,
|
|
133
|
+
]);
|
|
134
|
+
const playerRaw = present(playerCandidate, starbasePlayer.address, `Starbase Player ${starbasePlayer.address} is missing. Refresh it and retry.`);
|
|
135
|
+
present(characterCandidate, character, `Profile ${profile} has no Character ${character}. Register the Character and retry.`);
|
|
136
|
+
const player = starbasePlayerAccountDefinition.decode(playerRaw, ctx.programs);
|
|
137
|
+
if (player.playerProfile !== profile ||
|
|
138
|
+
player.system !== system ||
|
|
139
|
+
player.character !== character ||
|
|
140
|
+
(await deriveStarbasePlayerAddress(ctx.programs, system, character)) !==
|
|
141
|
+
starbasePlayer.address)
|
|
142
|
+
fail(`Starbase Player ${starbasePlayer.address} is not the canonical registration of Profile ${profile} and its Character at Star System ${system}. Refresh it and retry.`, starbasePlayer.address);
|
|
143
|
+
const systemData = await readStarbaseSystem(ctx, game, present(systemCandidate, system, `Star System ${system} is missing. Refresh it and retry.`), player.sequenceId, 'Register a Starbase Player at the current Starbase and retry.');
|
|
144
|
+
const materials = currentUpgradeMaterials(systemData.starbase);
|
|
145
|
+
if (materials === undefined)
|
|
146
|
+
fail(`The Starbase at ${systemData.name} (${system}) is at its maximum level, ${systemData.starbase.level}, so it takes no upgrade materials.`, system);
|
|
147
|
+
const requirement = materials.find((entry) => entry.cargoId === material);
|
|
148
|
+
if (requirement === undefined)
|
|
149
|
+
invalid('cargoId', material, `one of the upgrade materials ${materials.map((entry) => entry.cargoId).join(', ')}`, `Choose a material the ${systemData.starbase.level} Starbase at ${systemData.name} needs before retrying.`);
|
|
150
|
+
const remaining = requirement.needed > requirement.deposited
|
|
151
|
+
? requirement.needed - requirement.deposited
|
|
152
|
+
: 0n;
|
|
153
|
+
if (remaining === 0n)
|
|
154
|
+
fail(`The Starbase at ${systemData.name} (${system}) already has all ${String(requirement.needed)} of cargo ${String(material)} installed. Contribute another material, or install finished contributions to complete the upgrade.`, system);
|
|
155
|
+
if (amount > remaining)
|
|
156
|
+
fail(`The Starbase at ${systemData.name} (${system}) needs ${String(remaining)} more of cargo ${String(material)} (${String(requirement.deposited)} of ${String(requirement.needed)} installed); contribute at most that and retry.`, system);
|
|
157
|
+
if (crewCount < requirement.crew)
|
|
158
|
+
fail(`Cargo ${String(material)} needs at least ${String(requirement.crew)} crew per contribution, more than the ${String(crewCount)} requested. Assign more crew and retry.`, system);
|
|
159
|
+
const idle = player.totalCrew - player.busyCrew;
|
|
160
|
+
if (crewCount > idle)
|
|
161
|
+
fail(`Starbase Player ${starbasePlayer.address} has ${String(idle)} idle crew, fewer than the ${String(crewCount)} requested. Assign fewer crew or wait for busy crew to return, then retry.`, starbasePlayer.address);
|
|
162
|
+
const held = player.cargo.amounts.find((entry) => entry.cargoId === material)?.amount ??
|
|
163
|
+
0n;
|
|
164
|
+
if (held < amount)
|
|
165
|
+
fail(`Starbase Player ${starbasePlayer.address} holds ${String(held)} of cargo ${String(material)}, fewer than the ${String(amount)} to contribute. Bring more to the Starbase or contribute less, then retry.`, starbasePlayer.address);
|
|
166
|
+
if (processCandidate !== undefined)
|
|
167
|
+
fail(`Account ${upgradeProcess} already exists. Generate a new signer for the StarbaseUpgradeProcess and retry.`, upgradeProcess);
|
|
168
|
+
const instruction = adaptContributeToStarbaseUpgradeInstruction(ctx.programs, {
|
|
169
|
+
authorization,
|
|
170
|
+
character,
|
|
171
|
+
system,
|
|
172
|
+
starbasePlayer: starbasePlayer.address,
|
|
173
|
+
upgradeProcess,
|
|
174
|
+
game,
|
|
175
|
+
cargoId: material,
|
|
176
|
+
quantity: amount,
|
|
177
|
+
crew: crewCount,
|
|
178
|
+
});
|
|
179
|
+
const accounts = new Map([
|
|
180
|
+
[playerRaw.address, playerRaw],
|
|
181
|
+
[system, systemCandidate],
|
|
182
|
+
[profile, profileCandidate],
|
|
183
|
+
[RENT_ADDRESS, rent],
|
|
184
|
+
]);
|
|
185
|
+
const funding = planStorageFunding(ctx.programs, {
|
|
186
|
+
action: readStarbaseUpgradeStorageAction(ctx.programs, instruction, accounts),
|
|
187
|
+
accounts,
|
|
188
|
+
label: 'Starbase upgrade contribution',
|
|
189
|
+
});
|
|
190
|
+
const seconds = contributionSeconds(requirement.durationSeconds, amount, crewCount);
|
|
191
|
+
const description = `Contribute ${String(amount)} of cargo ${String(material)} and ${String(crewCount)} crew from Starbase Player ${starbasePlayer.address} to the ${systemData.starbase.level} Starbase at ${systemData.name} (${String(requirement.deposited)} of ${String(requirement.needed)} installed). The game takes the cargo now, caps it at what the Starbase still needs when the transaction executes, and keeps the crew busy until the contribution is installed or cancelled; it can be installed ${String(seconds)} seconds after the transaction. ${funding.disclosure} Key permissions and research access to the material remain chain-authoritative.`;
|
|
192
|
+
return buildPlannerPlan(ctx.programs, {
|
|
193
|
+
kind: 'starbases.contribute-upgrade',
|
|
194
|
+
preconditions: [
|
|
195
|
+
await accountStatePrecondition(playerRaw, `Starbase Player ${starbasePlayer.address} keeps its cargo, crew and Starbase.`),
|
|
196
|
+
starbaseSystemGuard(system, game, player.sequenceId),
|
|
197
|
+
accountAbsentPrecondition(upgradeProcess, `StarbaseUpgradeProcess ${upgradeProcess} remains absent until execution.`),
|
|
198
|
+
funding.guard,
|
|
199
|
+
],
|
|
200
|
+
steps: [
|
|
201
|
+
{
|
|
202
|
+
describes: description,
|
|
203
|
+
instruction,
|
|
204
|
+
signers: [authorization.authority, upgradeProcess],
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
summary: `Contribute ${String(amount)} of cargo ${String(material)} to the Starbase at ${systemData.name}.`,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
/** Reads and validates a contribution, its Starbase Player and Star System,
|
|
211
|
+
* and the chain Clock, for cancellation or installation. */
|
|
212
|
+
async function readProcess(ctx, process, input) {
|
|
213
|
+
const options = readOptions(input, ['authorization']);
|
|
214
|
+
const authorization = readPlanAuthorization(options.authorization);
|
|
215
|
+
const game = requireGameAddress(ctx);
|
|
216
|
+
const { profile } = authorization;
|
|
217
|
+
if (process.playerProfile.address !== profile)
|
|
218
|
+
fail(`StarbaseUpgradeProcess ${process.address} belongs to Profile ${process.playerProfile.address}; only that Profile can cancel or install it.`, process.address);
|
|
219
|
+
const character = await findCharacterPda(ctx.programs, profile, game);
|
|
220
|
+
const [processCandidate, playerCandidate, systemCandidate, clock] = await readContextRawAccounts(ctx, [
|
|
221
|
+
process.address,
|
|
222
|
+
process.starbasePlayer.address,
|
|
223
|
+
process.system.address,
|
|
224
|
+
CLOCK_ADDRESS,
|
|
225
|
+
]);
|
|
226
|
+
const processRaw = present(processCandidate, process.address, `StarbaseUpgradeProcess ${process.address} is missing, so it was already cancelled or installed. Refresh the Starbase Player's upgrade processes.`);
|
|
227
|
+
const data = starbaseUpgradeProcessAccountDefinition.decode(processRaw, ctx.programs);
|
|
228
|
+
if (data.playerProfile !== profile ||
|
|
229
|
+
data.starbasePlayer !== process.starbasePlayer.address ||
|
|
230
|
+
data.system !== process.system.address ||
|
|
231
|
+
data.starbaseSequenceId !== process.starbaseSequenceId ||
|
|
232
|
+
data.resourceId !== process.resource.id ||
|
|
233
|
+
data.quantityRaw !== process.resource.quantityRaw ||
|
|
234
|
+
data.numCrew !== process.numCrew ||
|
|
235
|
+
data.endsAtUnixSeconds !== process.endsAtUnixSeconds)
|
|
236
|
+
fail(`StarbaseUpgradeProcess ${process.address} no longer matches its Profile, Starbase Player, System, material, crew or end time. Refresh it and retry.`, process.address);
|
|
237
|
+
const playerRaw = present(playerCandidate, process.starbasePlayer.address, `Starbase Player ${process.starbasePlayer.address} is missing. Refresh it and retry.`);
|
|
238
|
+
const player = starbasePlayerAccountDefinition.decode(playerRaw, ctx.programs);
|
|
239
|
+
if (player.playerProfile !== profile ||
|
|
240
|
+
player.character !== character ||
|
|
241
|
+
player.system !== process.system.address ||
|
|
242
|
+
(await deriveStarbasePlayerAddress(ctx.programs, process.system.address, character)) !== process.starbasePlayer.address)
|
|
243
|
+
fail(`Starbase Player ${process.starbasePlayer.address} is not the canonical registration of Profile ${profile} and its Character at Star System ${process.system.address}. Refresh it and retry.`, process.starbasePlayer.address);
|
|
244
|
+
const systemRaw = present(systemCandidate, process.system.address, `Star System ${process.system.address} is missing. Refresh it and retry.`);
|
|
245
|
+
const system = await readStarbaseSystem(ctx, game, systemRaw, process.starbaseSequenceId, 'A contribution to an earlier Starbase can be neither cancelled nor installed; Atlas Kit does not plan its removal yet.');
|
|
246
|
+
if (player.sequenceId !== process.starbaseSequenceId)
|
|
247
|
+
fail(`Starbase Player ${process.starbasePlayer.address} belongs to an earlier Starbase at Star System ${process.system.address}. Refresh it and retry.`, process.starbasePlayer.address);
|
|
248
|
+
const [profileCandidate, rent] = await readContextRawAccounts(ctx, [
|
|
249
|
+
profile,
|
|
250
|
+
RENT_ADDRESS,
|
|
251
|
+
]);
|
|
252
|
+
return {
|
|
253
|
+
authorization,
|
|
254
|
+
game,
|
|
255
|
+
now: readClock(present(clock, CLOCK_ADDRESS, 'The chain Clock is missing. Retry against a complete RPC provider.')),
|
|
256
|
+
processRaw,
|
|
257
|
+
playerRaw,
|
|
258
|
+
player,
|
|
259
|
+
systemRaw,
|
|
260
|
+
system,
|
|
261
|
+
storageAccounts: new Map([
|
|
262
|
+
[playerRaw.address, playerRaw],
|
|
263
|
+
[processRaw.address, processRaw],
|
|
264
|
+
[profile, profileCandidate],
|
|
265
|
+
[RENT_ADDRESS, rent],
|
|
266
|
+
]),
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
/** Plans the cancellation of a running Starbase upgrade contribution: the game
|
|
270
|
+
* returns its whole material and crew to the Starbase Player and closes the
|
|
271
|
+
* StarbaseUpgradeProcess.
|
|
272
|
+
*
|
|
273
|
+
* The game cancels only a contribution whose time has not yet passed, so the
|
|
274
|
+
* planner refuses a finished one, which can be installed instead. The Plan
|
|
275
|
+
* must execute before the contribution ends.
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* ```ts
|
|
279
|
+
* declare const ctx: SageContext;
|
|
280
|
+
* declare const process: StarbaseUpgradeProcessSnapshot;
|
|
281
|
+
* declare const authorization: PlanAuthorization;
|
|
282
|
+
* const plan = await planCancelStarbaseUpgradeContribution(ctx, process, {
|
|
283
|
+
* authorization,
|
|
284
|
+
* });
|
|
285
|
+
* console.log(plan.describe());
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
export async function planCancelStarbaseUpgradeContribution(ctx, process, input) {
|
|
289
|
+
const context = await readProcess(ctx, process, input);
|
|
290
|
+
const { authorization, game, now } = context;
|
|
291
|
+
if (now >= process.endsAtUnixSeconds)
|
|
292
|
+
fail(`StarbaseUpgradeProcess ${process.address} finished at ${String(process.endsAtUnixSeconds)} (chain time ${String(now)}), and the game cancels only a running contribution. Install it instead with planInstallStarbaseUpgradeResource.`, process.address);
|
|
293
|
+
const instruction = adaptCancelStarbaseUpgradeContributionInstruction(ctx.programs, {
|
|
294
|
+
authorization,
|
|
295
|
+
system: process.system.address,
|
|
296
|
+
starbasePlayer: process.starbasePlayer.address,
|
|
297
|
+
upgradeProcess: process.address,
|
|
298
|
+
game,
|
|
299
|
+
});
|
|
300
|
+
const funding = planStorageFunding(ctx.programs, {
|
|
301
|
+
action: readStarbaseUpgradeStorageAction(ctx.programs, instruction, context.storageAccounts),
|
|
302
|
+
accounts: context.storageAccounts,
|
|
303
|
+
label: 'Starbase upgrade cancellation',
|
|
304
|
+
});
|
|
305
|
+
const description = `Cancel the contribution of ${String(process.resource.quantityRaw)} ${process.resource.name} to the Starbase at ${context.system.name}, returning the material and ${String(process.numCrew)} crew to Starbase Player ${process.starbasePlayer.address} and closing StarbaseUpgradeProcess ${process.address}. The game refuses the cancellation once the contribution ends at ${String(process.endsAtUnixSeconds)}. ${funding.disclosure}`;
|
|
306
|
+
return buildPlannerPlan(ctx.programs, {
|
|
307
|
+
kind: 'starbases.cancel-upgrade-contribution',
|
|
308
|
+
preconditions: [
|
|
309
|
+
{
|
|
310
|
+
kind: 'starbase-upgrade-cancel-window',
|
|
311
|
+
address: process.address,
|
|
312
|
+
endsAtUnixSeconds: process.endsAtUnixSeconds,
|
|
313
|
+
describes: `StarbaseUpgradeProcess ${process.address} is still running when the cancellation executes, before ${String(process.endsAtUnixSeconds)}; afterwards install it instead.`,
|
|
314
|
+
},
|
|
315
|
+
await accountStatePrecondition(context.processRaw, `StarbaseUpgradeProcess ${process.address} keeps its material, crew and end time.`),
|
|
316
|
+
starbaseSystemGuard(process.system.address, game, process.starbaseSequenceId),
|
|
317
|
+
funding.guard,
|
|
318
|
+
],
|
|
319
|
+
steps: [
|
|
320
|
+
{
|
|
321
|
+
describes: description,
|
|
322
|
+
instruction,
|
|
323
|
+
signers: [authorization.authority],
|
|
324
|
+
},
|
|
325
|
+
],
|
|
326
|
+
summary: `Cancel the ${process.resource.name} contribution to the Starbase at ${context.system.name}.`,
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
/** Plans the installation of a finished Starbase upgrade contribution: the
|
|
330
|
+
* game applies the material to the Starbase's current upgrade, returns what it
|
|
331
|
+
* no longer needs and the crew to the Starbase Player, closes the
|
|
332
|
+
* StarbaseUpgradeProcess and raises the Starbase's level once every material
|
|
333
|
+
* is installed.
|
|
334
|
+
*
|
|
335
|
+
* A Starbase rebuilt from level 0 joins the contributor's faction when it
|
|
336
|
+
* reaches level 1, except in a sanctuary System. Installed material can earn
|
|
337
|
+
* the contributor Loyalty Points for the current reward epoch; for a material
|
|
338
|
+
* with a configured rate, the game then needs the faction's Loyalty epoch and
|
|
339
|
+
* the Profile's contribution record, and the Plan opens whichever is missing
|
|
340
|
+
* first, its rent paid by the authorization key's wallet. The game refuses
|
|
341
|
+
* the installation outside the current reward epoch while rewards are
|
|
342
|
+
* enabled. Requires Disabled rent: the Game's rent catalog and the System's
|
|
343
|
+
* Starbase-level rent history must not exist.
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* ```ts
|
|
347
|
+
* declare const ctx: SageContext;
|
|
348
|
+
* declare const process: StarbaseUpgradeProcessSnapshot;
|
|
349
|
+
* declare const authorization: PlanAuthorization;
|
|
350
|
+
* const plan = await planInstallStarbaseUpgradeResource(ctx, process, {
|
|
351
|
+
* authorization,
|
|
352
|
+
* });
|
|
353
|
+
* console.log(plan.describe());
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
export async function planInstallStarbaseUpgradeResource(ctx, process, input) {
|
|
357
|
+
const context = await readProcess(ctx, process, input);
|
|
358
|
+
const { authorization, game, now, system } = context;
|
|
359
|
+
const systemAddress = process.system.address;
|
|
360
|
+
if (now < process.endsAtUnixSeconds)
|
|
361
|
+
fail(`StarbaseUpgradeProcess ${process.address} runs until ${String(process.endsAtUnixSeconds)} (chain time ${String(now)}). Wait until it ends and retry, or cancel it with planCancelStarbaseUpgradeContribution.`, process.address);
|
|
362
|
+
const materials = currentUpgradeMaterials(system.starbase);
|
|
363
|
+
const installed = installableUpgradeQuantity(materials, process.resource.id, process.resource.quantityRaw);
|
|
364
|
+
const returned = process.resource.quantityRaw - installed;
|
|
365
|
+
const completes = installed > 0n &&
|
|
366
|
+
materials.every((entry) => entry.deposited +
|
|
367
|
+
(entry.cargoId === process.resource.id ? installed : 0n) >=
|
|
368
|
+
entry.needed);
|
|
369
|
+
const [kingTracker, regionTracker, factionOwnership, rentState] = await Promise.all([
|
|
370
|
+
deriveKingSystemTrackerAddress(ctx.programs, game),
|
|
371
|
+
deriveRegionTrackerAddress(ctx.programs, game),
|
|
372
|
+
deriveFactionOwnershipAddress(ctx.programs, game, 'starbase', systemAddress),
|
|
373
|
+
requireDisabledLevelRent(ctx, game, { address: systemAddress, systemId: system.systemId }, 'the Starbase upgrade installation'),
|
|
374
|
+
]);
|
|
375
|
+
const reward = await resolveRewardContext(ctx, game, now, 'installations');
|
|
376
|
+
const [kingCandidate, regionCandidate] = await readContextRawAccounts(ctx, [
|
|
377
|
+
kingTracker,
|
|
378
|
+
regionTracker,
|
|
379
|
+
]);
|
|
380
|
+
// Both trackers are the Game's own by derivation; the game validates them.
|
|
381
|
+
for (const [candidate, address, name] of [
|
|
382
|
+
[kingCandidate, kingTracker, 'KingSystemTracker'],
|
|
383
|
+
[regionCandidate, regionTracker, 'RegionTracker'],
|
|
384
|
+
]) {
|
|
385
|
+
if (candidate === undefined || candidate.owner !== ctx.programs.sage)
|
|
386
|
+
fail(`${name} ${address} is missing for configured Game ${game}. Refresh world ownership and retry.`, address);
|
|
387
|
+
}
|
|
388
|
+
// Loyalty Points need the faction's epoch and the Profile's record; only
|
|
389
|
+
// the three major factions earn them.
|
|
390
|
+
const rate = reward.config.upgradeLpRates.find((entry) => entry.cargoId === process.resource.id)?.lpPerRawUnit ?? 0n;
|
|
391
|
+
const faction = factionValue(context.player.faction);
|
|
392
|
+
const earns = installed > 0n && rate > 0n && faction >= 1 && faction <= 3;
|
|
393
|
+
const loyalty = await resolveLoyaltyEarning(ctx, {
|
|
394
|
+
game,
|
|
395
|
+
profile: authorization.profile,
|
|
396
|
+
funder: authorization.authority,
|
|
397
|
+
faction,
|
|
398
|
+
reward,
|
|
399
|
+
earns,
|
|
400
|
+
});
|
|
401
|
+
const steps = [...loyalty.steps];
|
|
402
|
+
// The installation records the System's history and takes no Career XP or
|
|
403
|
+
// fee accounts.
|
|
404
|
+
const history = await resolveDemocracyHistory(ctx, {
|
|
405
|
+
game,
|
|
406
|
+
system: systemAddress,
|
|
407
|
+
});
|
|
408
|
+
const instruction = adaptInstallStarbaseUpgradeResourceInstruction(ctx.programs, {
|
|
409
|
+
...history.accounts,
|
|
410
|
+
...rentState.accounts,
|
|
411
|
+
authorization,
|
|
412
|
+
system: systemAddress,
|
|
413
|
+
starbasePlayer: process.starbasePlayer.address,
|
|
414
|
+
upgradeProcess: process.address,
|
|
415
|
+
regionTracker,
|
|
416
|
+
game,
|
|
417
|
+
rewardRegistry: reward.registry,
|
|
418
|
+
rewardConfig: reward.rewardConfig,
|
|
419
|
+
...(loyalty.loyaltyEpoch === undefined
|
|
420
|
+
? {}
|
|
421
|
+
: { loyaltyEpoch: loyalty.loyaltyEpoch }),
|
|
422
|
+
...(loyalty.loyaltyContribution === undefined
|
|
423
|
+
? {}
|
|
424
|
+
: { loyaltyContribution: loyalty.loyaltyContribution }),
|
|
425
|
+
kingTracker,
|
|
426
|
+
factionOwnership,
|
|
427
|
+
});
|
|
428
|
+
const funding = planStorageFunding(ctx.programs, {
|
|
429
|
+
action: readStarbaseUpgradeStorageAction(ctx.programs, instruction, context.storageAccounts),
|
|
430
|
+
accounts: context.storageAccounts,
|
|
431
|
+
label: 'Starbase upgrade installation',
|
|
432
|
+
});
|
|
433
|
+
const material = `${String(process.resource.quantityRaw)} ${process.resource.name}`;
|
|
434
|
+
const outcome = installed === 0n
|
|
435
|
+
? `The Starbase no longer needs ${process.resource.name}, so the game returns all ${material} to the Starbase Player.`
|
|
436
|
+
: `The game installs ${String(installed)} ${process.resource.name}${returned > 0n ? ` and returns the other ${String(returned)}` : ''}${completes ? `, which completes the ${system.starbase.level} upgrade and raises the Starbase's level` : ''}.`;
|
|
437
|
+
const points = earns
|
|
438
|
+
? ` The installed material can earn up to ${String(installed * rate)} Loyalty Points in reward epoch ${String(reward.currentEpoch)}.`
|
|
439
|
+
: installed > 0n && rate > 0n
|
|
440
|
+
? ` This material earns Loyalty Points only for MUD, ONI or Ustur players, so the game may refuse this installation for an unaligned Starbase Player.`
|
|
441
|
+
: '';
|
|
442
|
+
const description = `Install the contribution of ${material} to the Starbase at ${system.name}, returning ${String(process.numCrew)} crew to Starbase Player ${process.starbasePlayer.address} and closing StarbaseUpgradeProcess ${process.address}. ${outcome}${points} The amount installed follows the Starbase's state when the transaction executes. ${funding.disclosure}`;
|
|
443
|
+
steps.push({
|
|
444
|
+
describes: description,
|
|
445
|
+
instruction,
|
|
446
|
+
signers: [authorization.authority],
|
|
447
|
+
});
|
|
448
|
+
return buildPlannerPlan(ctx.programs, {
|
|
449
|
+
kind: 'starbases.install-upgrade-resource',
|
|
450
|
+
preconditions: [
|
|
451
|
+
{
|
|
452
|
+
kind: 'starbase-upgrade-install-window',
|
|
453
|
+
address: process.address,
|
|
454
|
+
endsAtUnixSeconds: process.endsAtUnixSeconds,
|
|
455
|
+
describes: `StarbaseUpgradeProcess ${process.address} has ended when the installation executes, at or after ${String(process.endsAtUnixSeconds)}.`,
|
|
456
|
+
},
|
|
457
|
+
loyalty.guard,
|
|
458
|
+
await accountStatePrecondition(context.processRaw, `StarbaseUpgradeProcess ${process.address} keeps its material, crew and end time.`),
|
|
459
|
+
...loyalty.preconditions,
|
|
460
|
+
...rentState.guards,
|
|
461
|
+
{
|
|
462
|
+
kind: 'democracy-history',
|
|
463
|
+
address: history.intent.address,
|
|
464
|
+
intent: history.intent,
|
|
465
|
+
accounts: history.accounts,
|
|
466
|
+
describes: 'The canonical System history remains eligible on the observed chain day; initialized history and effective policy must still match. Close pending checkpoints and recreate the Plan if the day changes.',
|
|
467
|
+
},
|
|
468
|
+
funding.guard,
|
|
469
|
+
],
|
|
470
|
+
steps,
|
|
471
|
+
summary: `Install the ${process.resource.name} contribution to the Starbase at ${system.name}.`,
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
//# sourceMappingURL=upgrades.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrades.js","sourceRoot":"","sources":["../../../src/starbases/actions/upgrades.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,aAAa,CAAC;AAGtD,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,EAC9B,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,uCAAuC,GAExC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,uBAAuB,EACvB,2BAA2B,GAG5B,MAAM,4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B,OAAO,CAAC,OAAO,0DAA0D,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,GAAG;aACnJ;YACD,OAAO,CAAC,KAAK;YACb,MAAM,wBAAwB,CAC5B,OAAO,CAAC,UAAU,EAClB,0BAA0B,OAAO,CAAC,OAAO,yCAAyC,CACnF;YACD,GAAG,OAAO,CAAC,aAAa;YACxB,GAAG,SAAS,CAAC,MAAM;YACnB;gBACE,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO;gBAC/B,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,SAAS,EACP,yMAAyM;aAC5M;YACD,OAAO,CAAC,KAAK;SACd;QACD,KAAK;QACL,OAAO,EAAE,eAAe,OAAO,CAAC,QAAQ,CAAC,IAAI,oCAAoC,MAAM,CAAC,IAAI,GAAG;KAChG,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -290,6 +290,10 @@ export interface DemocracyAllocationSnapshot {
|
|
|
290
290
|
readonly housing: readonly DemocracyHousing[];
|
|
291
291
|
/** The standing vote, or absent for an abstention. */
|
|
292
292
|
readonly vote: GovernanceParameters | undefined;
|
|
293
|
+
/** ATLAS earned as of the allocation's last checkpoint and not yet
|
|
294
|
+
* claimed. The game adds what was earned since when the allocation is next
|
|
295
|
+
* touched, so a claim can pay more. */
|
|
296
|
+
readonly unclaimedRewardAtlasRaw: bigint;
|
|
293
297
|
/** Every backing deposit, live and released, oldest first. */
|
|
294
298
|
readonly backings: readonly DemocracyBacking[];
|
|
295
299
|
toJSON(): unknown;
|
|
@@ -367,4 +371,75 @@ export declare function maybeGetDemocracyAllocation(context: SageContext, profil
|
|
|
367
371
|
* ```
|
|
368
372
|
*/
|
|
369
373
|
export declare function getDemocracyAllocation(context: SageContext, profile: Address, system: Address, options?: ReadOptions): Promise<DemocracyAllocationSnapshot>;
|
|
374
|
+
/** One CSS Housing item that backs voting power.
|
|
375
|
+
* @example
|
|
376
|
+
* ```ts
|
|
377
|
+
* declare const housing: DemocracyBackingHousing;
|
|
378
|
+
* console.log(housing.cargo.name, housing.capacityPerUnit);
|
|
379
|
+
* ```
|
|
380
|
+
*/
|
|
381
|
+
export interface DemocracyBackingHousing {
|
|
382
|
+
readonly cargo: CargoDefinitionSummary;
|
|
383
|
+
readonly faction: GovernanceFaction;
|
|
384
|
+
readonly tier: number;
|
|
385
|
+
/** Crew each unit houses. */
|
|
386
|
+
readonly capacityPerUnit: bigint;
|
|
387
|
+
}
|
|
388
|
+
/** The crew and CSS Housing Democracy requires to back voting power, as the
|
|
389
|
+
* game applies them to a voting-power request now.
|
|
390
|
+
*
|
|
391
|
+
* Every unit of voting power needs crew, and the housing deposited with it
|
|
392
|
+
* must house that crew. Only housing of the System's controlling faction
|
|
393
|
+
* counts.
|
|
394
|
+
* @example
|
|
395
|
+
* ```ts
|
|
396
|
+
* declare const rules: DemocracyBackingRulesSnapshot;
|
|
397
|
+
* console.log(`${rules.votingPowerPerCrew} voting power per crew`);
|
|
398
|
+
* ```
|
|
399
|
+
*/
|
|
400
|
+
export interface DemocracyBackingRulesSnapshot {
|
|
401
|
+
readonly kind: 'democracyBackingRules';
|
|
402
|
+
readonly address: Address;
|
|
403
|
+
readonly game: EntityRef<'game'>;
|
|
404
|
+
readonly curveVersion: number;
|
|
405
|
+
readonly housingMapVersion: number;
|
|
406
|
+
/** Up to `linearUpToVotingPower`, each crew member backs this much voting
|
|
407
|
+
* power, rounded up to whole crew. */
|
|
408
|
+
readonly votingPowerPerCrew: bigint;
|
|
409
|
+
/** Above this, each unit of voting power needs more crew; Atlas Kit does
|
|
410
|
+
* not compute that premium, and the game decides it. */
|
|
411
|
+
readonly linearUpToVotingPower: bigint;
|
|
412
|
+
readonly maximumVotingPower: bigint;
|
|
413
|
+
readonly housing: readonly DemocracyBackingHousing[];
|
|
414
|
+
/** Requirements published to take over in a later week. */
|
|
415
|
+
readonly scheduled: {
|
|
416
|
+
readonly curveVersion: number;
|
|
417
|
+
readonly housingMapVersion: number;
|
|
418
|
+
readonly fromUnixSeconds: bigint;
|
|
419
|
+
} | undefined;
|
|
420
|
+
toJSON(): unknown;
|
|
421
|
+
}
|
|
422
|
+
/** Reads the crew and CSS Housing Democracy requires to back voting power.
|
|
423
|
+
*
|
|
424
|
+
* The read reports the active requirements. Once `scheduled.fromUnixSeconds`
|
|
425
|
+
* has passed, the next voting-power request uses the scheduled pair instead;
|
|
426
|
+
* `planRequestDemocracyVotingPower` applies whichever pair the game will.
|
|
427
|
+
* @example
|
|
428
|
+
* ```ts
|
|
429
|
+
* declare const ctx: SageContext;
|
|
430
|
+
* const rules = await getDemocracyBackingRules(ctx);
|
|
431
|
+
* const crew = deriveDemocracyBackingCrew(rules, 40_000n);
|
|
432
|
+
* ```
|
|
433
|
+
*/
|
|
434
|
+
export declare function getDemocracyBackingRules(context: SageContext, options?: ReadOptions): Promise<DemocracyBackingRulesSnapshot>;
|
|
435
|
+
/** The crew, and the housing capacity, that back an amount of voting power
|
|
436
|
+
* under these rules; `undefined` above `linearUpToVotingPower`, where the game
|
|
437
|
+
* applies a premium Atlas Kit does not compute.
|
|
438
|
+
* @example
|
|
439
|
+
* ```ts
|
|
440
|
+
* declare const rules: DemocracyBackingRulesSnapshot;
|
|
441
|
+
* const crew = deriveDemocracyBackingCrew(rules, 40_000n); // 10n at 4,000 per crew
|
|
442
|
+
* ```
|
|
443
|
+
*/
|
|
444
|
+
export declare function deriveDemocracyBackingCrew(rules: Pick<DemocracyBackingRulesSnapshot, 'votingPowerPerCrew' | 'linearUpToVotingPower'>, votingPower: bigint): bigint | undefined;
|
|
370
445
|
//# sourceMappingURL=governance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"governance.d.ts","sourceRoot":"","sources":["../../src/starbases/governance.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,OAAO,EACZ,KAAK,SAAS,EAEd,KAAK,WAAW,EAChB,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