@aephia/atlas-kit 0.8.0-next.26 → 0.8.0-next.27
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/dist/claim-stakes/actions/index.d.ts +40 -0
- package/dist/claim-stakes/actions/index.d.ts.map +1 -1
- package/dist/claim-stakes/actions/index.js +110 -1
- 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/crafting/actions/habs.d.ts +47 -0
- package/dist/crafting/actions/habs.d.ts.map +1 -1
- package/dist/crafting/actions/habs.js +101 -2
- package/dist/crafting/actions/habs.js.map +1 -1
- package/dist/crafting/actions/index.d.ts +1 -1
- package/dist/crafting/actions/index.d.ts.map +1 -1
- package/dist/crafting/actions/index.js +1 -1
- package/dist/crafting/actions/index.js.map +1 -1
- package/dist/crafting/index.d.ts +1 -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/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/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 +2 -0
- package/dist/internal/c4/discriminators.d.ts.map +1 -1
- package/dist/internal/c4/discriminators.js +5 -1
- package/dist/internal/c4/discriminators.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/planning/authorization-adapter.d.ts +29 -0
- package/dist/internal/planning/authorization-adapter.d.ts.map +1 -1
- package/dist/internal/planning/authorization-adapter.js +44 -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/currency-cache-guard.d.ts.map +1 -1
- package/dist/internal/planning/currency-cache-guard.js +3 -1
- package/dist/internal/planning/currency-cache-guard.js.map +1 -1
- package/dist/internal/planning/plan-guards.d.ts.map +1 -1
- package/dist/internal/planning/plan-guards.js +1 -0
- package/dist/internal/planning/plan-guards.js.map +1 -1
- package/dist/internal/planning/rent-catalog.d.ts.map +1 -1
- package/dist/internal/planning/rent-catalog.js +10 -1
- package/dist/internal/planning/rent-catalog.js.map +1 -1
- package/dist/internal/planning/runtime-guards.d.ts.map +1 -1
- package/dist/internal/planning/runtime-guards.js +28 -10
- package/dist/internal/planning/runtime-guards.js.map +1 -1
- package/dist/planning/execution.d.ts.map +1 -1
- package/dist/planning/execution.js +14 -0
- package/dist/planning/execution.js.map +1 -1
- package/dist/planning/index.d.ts +11 -0
- package/dist/planning/index.d.ts.map +1 -1
- package/dist/planning/index.js.map +1 -1
- package/dist/planning/plan-validation.d.ts.map +1 -1
- package/dist/planning/plan-validation.js +4 -0
- package/dist/planning/plan-validation.js.map +1 -1
- package/package.json +1 -1
|
@@ -169,6 +169,17 @@ export interface PlanTopUpClaimStakeRentOptions {
|
|
|
169
169
|
readonly amount: bigint;
|
|
170
170
|
readonly authorization: PlanAuthorization;
|
|
171
171
|
}
|
|
172
|
+
/** Exact inputs for settling one owned Claim Stake's Building XP.
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* declare const authorization: PlanAuthorization;
|
|
177
|
+
* const options: PlanSettleClaimStakeBuildingXpOptions = { authorization };
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
export interface PlanSettleClaimStakeBuildingXpOptions {
|
|
181
|
+
readonly authorization: PlanAuthorization;
|
|
182
|
+
}
|
|
172
183
|
/** One exact raw cargo request for starting a Claim Stake Fleet transfer.
|
|
173
184
|
*
|
|
174
185
|
* @example
|
|
@@ -453,6 +464,35 @@ export declare function planDeconstructClaimStake(ctx: SageContext, stake: Claim
|
|
|
453
464
|
* ```
|
|
454
465
|
*/
|
|
455
466
|
export declare function planTopUpClaimStakeRent(ctx: SageContext, stake: ClaimStakeSnapshot, input: PlanTopUpClaimStakeRentOptions): Promise<Plan>;
|
|
467
|
+
/** Plans settling the Building XP one owned Claim Stake has earned.
|
|
468
|
+
*
|
|
469
|
+
* The game first brings the stake's rent and production up to date, which
|
|
470
|
+
* records any further paid operational time, then pays its recorded
|
|
471
|
+
* operational work to the owner's Character as Building XP, up to the
|
|
472
|
+
* Character's remaining Building allowance, and awards any claim Mining XP the
|
|
473
|
+
* stake recorded. Work beyond the allowance is discarded rather than carried,
|
|
474
|
+
* so the planner refuses while the allowance is empty, and it refuses a stake
|
|
475
|
+
* that has recorded no work and is not operational. The Plan states the
|
|
476
|
+
* recorded XP and the allowance; the exact grant remains chain-authoritative.
|
|
477
|
+
*
|
|
478
|
+
* Requires Disabled rent, the stake's current System generation and the
|
|
479
|
+
* Profile's Starbase Player there from the current Starbase.
|
|
480
|
+
* Bringing a large structure up to date can take more than the default
|
|
481
|
+
* 200,000 compute units, so simulate first and raise `computeUnitLimit` when
|
|
482
|
+
* assembling if needed.
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* ```ts
|
|
486
|
+
* declare const ctx: SageContext;
|
|
487
|
+
* declare const stake: ClaimStakeSnapshot;
|
|
488
|
+
* declare const authorization: PlanAuthorization;
|
|
489
|
+
* const plan = await planSettleClaimStakeBuildingXp(ctx, stake, {
|
|
490
|
+
* authorization,
|
|
491
|
+
* });
|
|
492
|
+
* console.log(plan.describe());
|
|
493
|
+
* ```
|
|
494
|
+
*/
|
|
495
|
+
export declare function planSettleClaimStakeBuildingXp(ctx: SageContext, stake: ClaimStakeSnapshot, input: PlanSettleClaimStakeBuildingXpOptions): Promise<Plan>;
|
|
456
496
|
/** Plans the start of one Fleet transfer to an owned active Claim Stake.
|
|
457
497
|
*
|
|
458
498
|
* The planner validates the shared Profile/Game, idle Fleet with normalized
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/claim-stakes/actions/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,OAAO,EAAoB,MAAM,aAAa,CAAC;AAExE,OAAO,KAAK,EAEV,WAAW,EAEZ,MAAM,2BAA2B,CAAC;AAGnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AA6CtD,OAAO,EAKL,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAE7B,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/claim-stakes/actions/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,OAAO,EAAoB,MAAM,aAAa,CAAC;AAExE,OAAO,KAAK,EAEV,WAAW,EAEZ,MAAM,2BAA2B,CAAC;AAGnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AA6CtD,OAAO,EAKL,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAE7B,MAAM,4BAA4B,CAAC;AAwBpC,OAAO,EAYL,KAAK,iBAAiB,EACvB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAoB,MAAM,yBAAyB,CAAC;AAEtE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAMxE,OAAO,KAAK,EAAE,kBAAkB,EA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ACtC,OAAO,CAAC,IAAI,CAAC,CA0Of;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,kBAAkB,EACzB,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,IAAI,CAAC,CAwGf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,8BAA8B,CAClD,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,kBAAkB,EACzB,KAAK,EAAE,qCAAqC,GAC3C,OAAO,CAAC,IAAI,CAAC,CAqHf;AAmJD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAsB,gCAAgC,CACpD,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,kBAAkB,EACzB,KAAK,EAAE,uCAAuC,GAC7C,OAAO,CAAC,IAAI,CAAC,CAqSf;AA8ID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,kCAAkC,CACtD,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,kBAAkB,EACzB,KAAK,EAAE,yCAAyC,GAC/C,OAAO,CAAC,IAAI,CAAC,CAyJf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAsB,+BAA+B,CACnD,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,kBAAkB,EACzB,KAAK,EAAE,sCAAsC,GAC5C,OAAO,CAAC,IAAI,CAAC,CAgNf"}
|
|
@@ -16,6 +16,7 @@ import { deriveProfileFactionAddress, profileFactionIdentityAccountDefinition, }
|
|
|
16
16
|
import { deriveStarbasePlayerAddress, starbasePlayerAccountDefinition, } from '../../internal/c4/starbase.js';
|
|
17
17
|
import { celestialBodyAccountDefinition, deriveCelestialBodyAddress, deriveStarSystemAddress, starSystemAccountDefinition, } from '../../internal/c4/world.js';
|
|
18
18
|
import { resolveXpRuntime } from '../../internal/planning/xp-runtime.js';
|
|
19
|
+
import { describeBuildingXpSettlement } from '../../internal/planning/building-xp.js';
|
|
19
20
|
import { readClaimStakeStorageAction } from '../../internal/planning/claim-stake-storage-actions.js';
|
|
20
21
|
import { RENT_ADDRESS } from '../../internal/planning/rent.js';
|
|
21
22
|
import { planStorageFunding } from '../../internal/planning/storage-actions.js';
|
|
@@ -27,7 +28,7 @@ import { requireProfileStarbasePlayer } from '../../internal/planning/starbase-p
|
|
|
27
28
|
import { requireGameAddress } from '../../internal/game-context.js';
|
|
28
29
|
import { structurePlacementFee } from '../../internal/planning/placement-fee.js';
|
|
29
30
|
import { cargoStorageUnits, cargoStorageUnitsFloor, } from '../../internal/cargo.js';
|
|
30
|
-
import { adaptCancelClaimStakeBuildingChangesInstruction, adaptClaimStakeBuildingChangesInstruction, adaptDeconstructClaimStakeInstruction, adaptExitClaimStakeFleetTransferInstruction, adaptFinalizeClaimStakeBuildingChangesInstruction, adaptPlaceClaimStakeInstruction, adaptRecoverClaimStakeFleetTransferInstruction, adaptStartClaimStakeFleetTransferInstruction, adaptTopUpClaimStakeRentInstruction, readPlanAuthorization, } from '../../internal/planning/authorization-adapter.js';
|
|
31
|
+
import { adaptCancelClaimStakeBuildingChangesInstruction, adaptClaimStakeBuildingChangesInstruction, adaptDeconstructClaimStakeInstruction, adaptExitClaimStakeFleetTransferInstruction, adaptFinalizeClaimStakeBuildingChangesInstruction, adaptPlaceClaimStakeInstruction, adaptRecoverClaimStakeFleetTransferInstruction, adaptSettleClaimStakeBuildingXpInstruction, adaptStartClaimStakeFleetTransferInstruction, adaptTopUpClaimStakeRentInstruction, readPlanAuthorization, } from '../../internal/planning/authorization-adapter.js';
|
|
31
32
|
import { buildPlannerPlan } from '../../planning/plan-construction.js';
|
|
32
33
|
import { readFreshGameCargoDefinitions } from '../../registry/cargo.js';
|
|
33
34
|
import { listClaimStakeBuildingDefinitions, resolveCargo, } from '../../registry/index.js';
|
|
@@ -189,6 +190,11 @@ function validateDeconstructOptions(value) {
|
|
|
189
190
|
exactKeys(options, 'options', ['authorization']);
|
|
190
191
|
return { authorization: readPlanAuthorization(options.authorization) };
|
|
191
192
|
}
|
|
193
|
+
function validateSettleBuildingXpOptions(value) {
|
|
194
|
+
const options = record(value, 'options');
|
|
195
|
+
exactKeys(options, 'options', ['authorization']);
|
|
196
|
+
return { authorization: readPlanAuthorization(options.authorization) };
|
|
197
|
+
}
|
|
192
198
|
function validateTopUpRentOptions(value) {
|
|
193
199
|
const options = record(value, 'options');
|
|
194
200
|
exactKeys(options, 'options', ['amount', 'authorization']);
|
|
@@ -1581,6 +1587,109 @@ export async function planTopUpClaimStakeRent(ctx, stake, input) {
|
|
|
1581
1587
|
summary: description,
|
|
1582
1588
|
});
|
|
1583
1589
|
}
|
|
1590
|
+
/** Plans settling the Building XP one owned Claim Stake has earned.
|
|
1591
|
+
*
|
|
1592
|
+
* The game first brings the stake's rent and production up to date, which
|
|
1593
|
+
* records any further paid operational time, then pays its recorded
|
|
1594
|
+
* operational work to the owner's Character as Building XP, up to the
|
|
1595
|
+
* Character's remaining Building allowance, and awards any claim Mining XP the
|
|
1596
|
+
* stake recorded. Work beyond the allowance is discarded rather than carried,
|
|
1597
|
+
* so the planner refuses while the allowance is empty, and it refuses a stake
|
|
1598
|
+
* that has recorded no work and is not operational. The Plan states the
|
|
1599
|
+
* recorded XP and the allowance; the exact grant remains chain-authoritative.
|
|
1600
|
+
*
|
|
1601
|
+
* Requires Disabled rent, the stake's current System generation and the
|
|
1602
|
+
* Profile's Starbase Player there from the current Starbase.
|
|
1603
|
+
* Bringing a large structure up to date can take more than the default
|
|
1604
|
+
* 200,000 compute units, so simulate first and raise `computeUnitLimit` when
|
|
1605
|
+
* assembling if needed.
|
|
1606
|
+
*
|
|
1607
|
+
* @example
|
|
1608
|
+
* ```ts
|
|
1609
|
+
* declare const ctx: SageContext;
|
|
1610
|
+
* declare const stake: ClaimStakeSnapshot;
|
|
1611
|
+
* declare const authorization: PlanAuthorization;
|
|
1612
|
+
* const plan = await planSettleClaimStakeBuildingXp(ctx, stake, {
|
|
1613
|
+
* authorization,
|
|
1614
|
+
* });
|
|
1615
|
+
* console.log(plan.describe());
|
|
1616
|
+
* ```
|
|
1617
|
+
*/
|
|
1618
|
+
export async function planSettleClaimStakeBuildingXp(ctx, stake, input) {
|
|
1619
|
+
const options = validateSettleBuildingXpOptions(input);
|
|
1620
|
+
const game = requireGameAddress(ctx);
|
|
1621
|
+
const { profile } = options.authorization;
|
|
1622
|
+
const character = await requireOwnedStake(ctx.programs, stake, game, profile);
|
|
1623
|
+
const currencyCache = await claimStakeCurrencyCache(ctx.programs, game);
|
|
1624
|
+
const action = 'the Building XP settlement';
|
|
1625
|
+
const [{ bodyAccount, currentBody, currentStake, extraAccounts: [characterCandidate, cacheCandidate], stakeAccount, }, rent, xp,] = await Promise.all([
|
|
1626
|
+
readOwnedStake(ctx, stake, action, [character, currencyCache]),
|
|
1627
|
+
requireDisabledStakeRent(ctx, game, stake.address, action),
|
|
1628
|
+
resolveClaimStakeXp(ctx, game, character),
|
|
1629
|
+
]);
|
|
1630
|
+
if (!sameOwnedStake(currentStake, stake, game, profile)) {
|
|
1631
|
+
fail(`Claim Stake ${stake.address} changed or does not match its loaded ownership, Body, definitions, buildings, or System generation. Refresh it and retry ${action}.`, stake.address);
|
|
1632
|
+
}
|
|
1633
|
+
// A Character's XP runtime names both accounts or refuses the Character.
|
|
1634
|
+
const xpBudget = xp.accounts.xpBudget;
|
|
1635
|
+
const xpBudgetConfig = xp.accounts.xpBudgetConfig;
|
|
1636
|
+
const { system } = await requireStakePlanet(ctx.programs, currentBody, stake, game, action);
|
|
1637
|
+
// The settlement writes the Character's XP, which other actions change
|
|
1638
|
+
// too, so the Plan checks its identity without pinning its state.
|
|
1639
|
+
requireProfileCharacter(ctx.programs, characterCandidate, character, profile, game, action);
|
|
1640
|
+
const [cacheGuard, { currentPlayer, currentSystem, player, playerAccount, systemAccount },] = await Promise.all([
|
|
1641
|
+
requireCurrencyCache(ctx.programs, cacheCandidate, currencyCache, game, action, 'planSettleClaimStakeBuildingXp'),
|
|
1642
|
+
readStakeStarbase(ctx, stake, game, system, character, profile, action),
|
|
1643
|
+
]);
|
|
1644
|
+
if (currentPlayer.sequenceId !== currentSystem.sequenceId)
|
|
1645
|
+
fail(`Starbase Player ${player} was registered at an earlier Starbase in Star System ${system}, which the game treats as destroyed. Register at the current Starbase and retry ${action}.`, player);
|
|
1646
|
+
const settlement = await describeBuildingXpSettlement(ctx, {
|
|
1647
|
+
structure: `Claim Stake ${stake.address}`,
|
|
1648
|
+
game,
|
|
1649
|
+
character,
|
|
1650
|
+
xpBudget,
|
|
1651
|
+
xpBudgetConfig,
|
|
1652
|
+
recorded: currentStake.operationalXp,
|
|
1653
|
+
operational: currentStake.state.kind === 'active' &&
|
|
1654
|
+
currentStake.constructionRemainingSeconds === 0n,
|
|
1655
|
+
});
|
|
1656
|
+
const description = `Settle Claim Stake ${stake.address}'s Building XP after bringing its rent and production up to date. ${settlement.description} Any claim Mining XP the stake recorded is awarded too.`;
|
|
1657
|
+
return buildPlannerPlan(ctx.programs, {
|
|
1658
|
+
kind: 'claim-stakes.settle-building-xp',
|
|
1659
|
+
preconditions: [
|
|
1660
|
+
...(await Promise.all([
|
|
1661
|
+
accountStatePrecondition(stakeAccount, `Claim Stake ${stake.address} retains its ownership, buildings, rent, production, lifecycle state, recorded Building work, Body, and System generation.`),
|
|
1662
|
+
planetPrecondition(bodyAccount, system),
|
|
1663
|
+
systemPrecondition(systemAccount, currentSystem.name),
|
|
1664
|
+
playerPrecondition(playerAccount, player),
|
|
1665
|
+
])),
|
|
1666
|
+
cacheGuard,
|
|
1667
|
+
xp.guard,
|
|
1668
|
+
settlement.guard,
|
|
1669
|
+
...rent.guards,
|
|
1670
|
+
],
|
|
1671
|
+
steps: [
|
|
1672
|
+
{
|
|
1673
|
+
describes: description,
|
|
1674
|
+
instruction: adaptSettleClaimStakeBuildingXpInstruction(ctx.programs, {
|
|
1675
|
+
authorization: options.authorization,
|
|
1676
|
+
celestialBody: stake.body.address,
|
|
1677
|
+
character,
|
|
1678
|
+
claimStakeInstance: stake.address,
|
|
1679
|
+
currencyCache,
|
|
1680
|
+
game,
|
|
1681
|
+
...rent.accounts,
|
|
1682
|
+
systemAndStarbasePlayerStarbasePlayer: player,
|
|
1683
|
+
systemAndStarbasePlayerSystem: system,
|
|
1684
|
+
xpBudget,
|
|
1685
|
+
xpBudgetConfig,
|
|
1686
|
+
}),
|
|
1687
|
+
signers: [options.authorization.authority],
|
|
1688
|
+
},
|
|
1689
|
+
],
|
|
1690
|
+
summary: description,
|
|
1691
|
+
});
|
|
1692
|
+
}
|
|
1584
1693
|
function cargoAmount(values, cargoId) {
|
|
1585
1694
|
return values.find((item) => item.cargoId === cargoId)?.amount ?? 0n;
|
|
1586
1695
|
}
|