@aephia/atlas-kit 0.6.0-next.125 → 0.6.0-next.126
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 +29 -0
- package/dist/claim-stakes/actions/index.d.ts.map +1 -1
- package/dist/claim-stakes/actions/index.js +102 -23
- package/dist/claim-stakes/actions/index.js.map +1 -1
- package/dist/combat/actions/index.d.ts +4 -0
- package/dist/combat/actions/index.d.ts.map +1 -1
- package/dist/combat/actions/index.js +9 -1
- package/dist/combat/actions/index.js.map +1 -1
- package/dist/internal/c4/crafting.d.ts +1 -1
- package/dist/internal/c4/crafting.js +1 -1
- package/dist/internal/c4/discriminators.d.ts +3 -0
- package/dist/internal/c4/discriminators.d.ts.map +1 -1
- package/dist/internal/c4/discriminators.js +7 -1
- package/dist/internal/c4/discriminators.js.map +1 -1
- package/dist/internal/c4/pda.d.ts +12 -0
- package/dist/internal/c4/pda.d.ts.map +1 -1
- package/dist/internal/c4/pda.js +23 -0
- package/dist/internal/c4/pda.js.map +1 -1
- package/dist/internal/c4/profile-permissions.d.ts +1 -1
- package/dist/internal/c4/profile-permissions.d.ts.map +1 -1
- package/dist/internal/c4/profile-permissions.js +2 -0
- package/dist/internal/c4/profile-permissions.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 +11 -11
- package/dist/internal/planning/authorization-adapter.d.ts.map +1 -1
- package/dist/internal/planning/authorization-adapter.js +50 -5
- package/dist/internal/planning/authorization-adapter.js.map +1 -1
- package/dist/internal/planning/currency-cache-guard.d.ts.map +1 -1
- package/dist/internal/planning/currency-cache-guard.js +2 -1
- package/dist/internal/planning/currency-cache-guard.js.map +1 -1
- package/dist/internal/planning/fleet-dock-funding-guard.js +1 -1
- package/dist/internal/planning/fleet-dock-funding-guard.js.map +1 -1
- package/dist/internal/planning/rent-catalog.d.ts +37 -0
- package/dist/internal/planning/rent-catalog.d.ts.map +1 -0
- package/dist/internal/planning/rent-catalog.js +165 -0
- package/dist/internal/planning/rent-catalog.js.map +1 -0
- package/dist/internal/planning/runtime-guards.d.ts.map +1 -1
- package/dist/internal/planning/runtime-guards.js +42 -24
- package/dist/internal/planning/runtime-guards.js.map +1 -1
- package/dist/planning/index.d.ts +1 -1
- package/dist/planning/index.js +2 -2
- package/dist/planning/plan-construction.js +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 +2 -2
|
@@ -236,6 +236,9 @@ interface FleetSnapshot extends Omit<ResolvedFleetAccountData, 'ownerProfile'> {
|
|
|
236
236
|
* permissions, placement races, rent arithmetic, and program capacity remain
|
|
237
237
|
* chain-authoritative.
|
|
238
238
|
*
|
|
239
|
+
* The new Claim Stake's rent settlement authority must not exist and stays
|
|
240
|
+
* guarded absent until signing.
|
|
241
|
+
*
|
|
239
242
|
* @example
|
|
240
243
|
* ```ts
|
|
241
244
|
* declare const ctx: SageContext;
|
|
@@ -260,6 +263,10 @@ export declare function planPlaceClaimStake(ctx: SageContext, body: CelestialBod
|
|
|
260
263
|
* Requires Game 2 and its existing canonical Claim Stake XP ledger.
|
|
261
264
|
* Missing XP state must be repaired outside this Plan; no accounts are created.
|
|
262
265
|
*
|
|
266
|
+
* Requires Disabled rent: the Game's rent catalog and the Claim Stake's rent
|
|
267
|
+
* settlement authority must not exist, and both stay guarded absent until
|
|
268
|
+
* signing. The instruction carries no rent history.
|
|
269
|
+
*
|
|
263
270
|
* @example
|
|
264
271
|
* ```ts
|
|
265
272
|
* declare const ctx: SageContext;
|
|
@@ -281,6 +288,10 @@ export declare function planClaimStakeBuildingChanges(ctx: SageContext, stake: C
|
|
|
281
288
|
* The Character XP budget and configuration must also be reconciled.
|
|
282
289
|
* Missing XP state must be repaired outside this Plan; no accounts are created.
|
|
283
290
|
*
|
|
291
|
+
* Requires Disabled rent: the Game's rent catalog and the Claim Stake's rent
|
|
292
|
+
* settlement authority must not exist, and both stay guarded absent until
|
|
293
|
+
* signing. The instruction carries no rent history.
|
|
294
|
+
*
|
|
284
295
|
* @example
|
|
285
296
|
* ```ts
|
|
286
297
|
* declare const ctx: SageContext;
|
|
@@ -305,6 +316,10 @@ export declare function planFinalizeClaimStakeBuildingChanges(ctx: SageContext,
|
|
|
305
316
|
* Requires Game 2 and its existing canonical Claim Stake XP ledger.
|
|
306
317
|
* Missing XP state must be repaired outside this Plan; no accounts are created.
|
|
307
318
|
*
|
|
319
|
+
* Requires Disabled rent: the Game's rent catalog and the Claim Stake's rent
|
|
320
|
+
* settlement authority must not exist, and both stay guarded absent until
|
|
321
|
+
* signing. The instruction carries no rent history.
|
|
322
|
+
*
|
|
308
323
|
* @example
|
|
309
324
|
* ```ts
|
|
310
325
|
* declare const ctx: SageContext;
|
|
@@ -326,6 +341,12 @@ export declare function planCancelClaimStakeBuildingChanges(ctx: SageContext, st
|
|
|
326
341
|
* Rent settlement, cargo return, account closure, and concurrent races remain
|
|
327
342
|
* chain-authoritative; the Plan does not estimate a refund.
|
|
328
343
|
*
|
|
344
|
+
* Requires Disabled rent: the Game's rent catalog and the Claim Stake's rent
|
|
345
|
+
* settlement authority must not exist, and both stay guarded absent until
|
|
346
|
+
* signing. The instruction carries no rent history. Deconstruction also
|
|
347
|
+
* requires the canonical Currency Cache and closes the Claim Stake's XP ledger;
|
|
348
|
+
* a Claim Stake without a ledger accrued no XP.
|
|
349
|
+
*
|
|
329
350
|
* @example
|
|
330
351
|
* ```ts
|
|
331
352
|
* declare const ctx: SageContext;
|
|
@@ -343,6 +364,10 @@ export declare function planDeconstructClaimStake(ctx: SageContext, stake: Claim
|
|
|
343
364
|
* known raw ATLAS balance. Permission checks, concurrent balance changes, rent
|
|
344
365
|
* arithmetic, and duration purchased remain chain-authoritative.
|
|
345
366
|
*
|
|
367
|
+
* Requires Disabled rent: the Game's rent catalog and the Claim Stake's rent
|
|
368
|
+
* settlement authority must not exist, and both stay guarded absent until
|
|
369
|
+
* signing. The instruction carries no rent history.
|
|
370
|
+
*
|
|
346
371
|
* @example
|
|
347
372
|
* ```ts
|
|
348
373
|
* declare const ctx: SageContext;
|
|
@@ -370,6 +395,10 @@ export declare function planTopUpClaimStakeRent(ctx: SageContext, stake: ClaimSt
|
|
|
370
395
|
* Requires Game 2 and its existing canonical Claim Stake XP ledger.
|
|
371
396
|
* Missing XP state must be repaired outside this Plan; no accounts are created.
|
|
372
397
|
*
|
|
398
|
+
* Requires Disabled rent: the Game's rent catalog and the Claim Stake's rent
|
|
399
|
+
* settlement authority must not exist, and both stay guarded absent until
|
|
400
|
+
* signing. The instruction carries no rent history.
|
|
401
|
+
*
|
|
373
402
|
* @example
|
|
374
403
|
* ```ts
|
|
375
404
|
* declare const ctx: SageContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/claim-stakes/actions/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAkCtD,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,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGzE,OAAO,KAAK,EAAE,SAAS,EAAE,M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ACzB,KAAK,EAAE,gCAAgC,GACtC,OAAO,CAAC,IAAI,CAAC,CAuPf;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,kBAAkB,EACzB,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,IAAI,CAAC,CAqGf;AA2ED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,gCAAgC,CACpD,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,kBAAkB,EACzB,KAAK,EAAE,uCAAuC,GAC7C,OAAO,CAAC,IAAI,CAAC,CAoPf;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;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,CAqNf"}
|
|
@@ -14,6 +14,8 @@ import { deriveProfileFactionAddress, profileFactionIdentityAccountDefinition, }
|
|
|
14
14
|
import { deriveStarbasePlayerAddress, starbasePlayerAccountDefinition, } from '../../internal/c4/starbase.js';
|
|
15
15
|
import { celestialBodyAccountDefinition, deriveCelestialBodyAddress, deriveStarSystemAddress, starSystemAccountDefinition, } from '../../internal/c4/world.js';
|
|
16
16
|
import { resolveXpRuntime } from '../../internal/planning/xp-runtime.js';
|
|
17
|
+
import { requireDisabledStakeRent, requireNewStakeRent, } from '../../internal/planning/rent-catalog.js';
|
|
18
|
+
import { deriveStructureXpAccrualAddress } from '../../internal/c4/pda.js';
|
|
17
19
|
import { requireProfileStarbasePlayer } from '../../internal/planning/starbase-player-owner.js';
|
|
18
20
|
import { requireGameAddress } from '../../internal/game-context.js';
|
|
19
21
|
import { cargoStorageUnits } from '../../internal/cargo.js';
|
|
@@ -266,6 +268,9 @@ function claimedCount(details, definitionId) {
|
|
|
266
268
|
* permissions, placement races, rent arithmetic, and program capacity remain
|
|
267
269
|
* chain-authoritative.
|
|
268
270
|
*
|
|
271
|
+
* The new Claim Stake's rent settlement authority must not exist and stays
|
|
272
|
+
* guarded absent until signing.
|
|
273
|
+
*
|
|
269
274
|
* @example
|
|
270
275
|
* ```ts
|
|
271
276
|
* declare const ctx: SageContext;
|
|
@@ -293,7 +298,7 @@ export async function planPlaceClaimStake(ctx, body, player, input) {
|
|
|
293
298
|
if (body.system.address !== player.system.address) {
|
|
294
299
|
fail(`Celestial Body ${body.address} belongs to System ${body.system.address}, but Starbase Player ${player.address} belongs to System ${player.system.address}. Choose both snapshots from the same System and retry.`, body.address);
|
|
295
300
|
}
|
|
296
|
-
const [freshGame, currentAccounts] = await Promise.all([
|
|
301
|
+
const [freshGame, currentAccounts, rent] = await Promise.all([
|
|
297
302
|
readFreshGameClaimStakeConfiguration(ctx),
|
|
298
303
|
readContextRawAccounts(ctx, [
|
|
299
304
|
body.address,
|
|
@@ -302,6 +307,7 @@ export async function planPlaceClaimStake(ctx, body, player, input) {
|
|
|
302
307
|
body.system.address,
|
|
303
308
|
options.claimStake,
|
|
304
309
|
]),
|
|
310
|
+
requireNewStakeRent(ctx, options.claimStake),
|
|
305
311
|
]);
|
|
306
312
|
if (freshGame === undefined) {
|
|
307
313
|
fail(`Configured Game ${game} is missing. Refresh the Game catalog and retry placement.`, game);
|
|
@@ -387,6 +393,7 @@ export async function planPlaceClaimStake(ctx, body, player, input) {
|
|
|
387
393
|
accountStatePrecondition(currentSystemAccount, `Star System ${currentSystem.name} retains its configured Game, sequence, and active Starbase level.`),
|
|
388
394
|
])),
|
|
389
395
|
accountAbsentPrecondition(options.claimStake, 'The caller-supplied Claim Stake signer address remains unallocated.'),
|
|
396
|
+
...rent.guards,
|
|
390
397
|
],
|
|
391
398
|
steps: [
|
|
392
399
|
{
|
|
@@ -402,6 +409,7 @@ export async function planPlaceClaimStake(ctx, body, player, input) {
|
|
|
402
409
|
hubBuildingId: hub.id,
|
|
403
410
|
initialRentAmount: options.initialRentAmount,
|
|
404
411
|
profileFaction,
|
|
412
|
+
rentAuthority: rent.rentAuthority,
|
|
405
413
|
systemAndStarbasePlayerStarbasePlayer: player.address,
|
|
406
414
|
systemAndStarbasePlayerSystem: body.system.address,
|
|
407
415
|
}),
|
|
@@ -609,6 +617,10 @@ function buildingDescription(change, name) {
|
|
|
609
617
|
* Requires Game 2 and its existing canonical Claim Stake XP ledger.
|
|
610
618
|
* Missing XP state must be repaired outside this Plan; no accounts are created.
|
|
611
619
|
*
|
|
620
|
+
* Requires Disabled rent: the Game's rent catalog and the Claim Stake's rent
|
|
621
|
+
* settlement authority must not exist, and both stay guarded absent until
|
|
622
|
+
* signing. The instruction carries no rent history.
|
|
623
|
+
*
|
|
612
624
|
* @example
|
|
613
625
|
* ```ts
|
|
614
626
|
* declare const ctx: SageContext;
|
|
@@ -627,9 +639,10 @@ export async function planClaimStakeBuildingChanges(ctx, stake, input) {
|
|
|
627
639
|
}
|
|
628
640
|
const character = await requireOwnedStake(stake, game, profile);
|
|
629
641
|
const action = 'building changes';
|
|
630
|
-
const [freshGame, loaded] = await Promise.all([
|
|
642
|
+
const [freshGame, loaded, rent] = await Promise.all([
|
|
631
643
|
readFreshGameClaimStakeConfiguration(ctx),
|
|
632
644
|
readOwnedStake(ctx, stake, action, [character]),
|
|
645
|
+
requireDisabledStakeRent(ctx, game, stake.address, action),
|
|
633
646
|
]);
|
|
634
647
|
if (freshGame === undefined) {
|
|
635
648
|
fail(`Configured Game ${game} is missing. Refresh the Game catalog and retry building changes.`, game);
|
|
@@ -810,6 +823,7 @@ export async function planClaimStakeBuildingChanges(ctx, stake, input) {
|
|
|
810
823
|
])),
|
|
811
824
|
ownershipPrecondition,
|
|
812
825
|
xp.guard,
|
|
826
|
+
...rent.guards,
|
|
813
827
|
],
|
|
814
828
|
steps: [
|
|
815
829
|
{
|
|
@@ -824,6 +838,7 @@ export async function planClaimStakeBuildingChanges(ctx, stake, input) {
|
|
|
824
838
|
factionOwnership: ownership,
|
|
825
839
|
game,
|
|
826
840
|
profileFaction,
|
|
841
|
+
...rent.accounts,
|
|
827
842
|
sequenceId,
|
|
828
843
|
starbasePlayer: player,
|
|
829
844
|
system,
|
|
@@ -845,6 +860,10 @@ export async function planClaimStakeBuildingChanges(ctx, stake, input) {
|
|
|
845
860
|
* The Character XP budget and configuration must also be reconciled.
|
|
846
861
|
* Missing XP state must be repaired outside this Plan; no accounts are created.
|
|
847
862
|
*
|
|
863
|
+
* Requires Disabled rent: the Game's rent catalog and the Claim Stake's rent
|
|
864
|
+
* settlement authority must not exist, and both stay guarded absent until
|
|
865
|
+
* signing. The instruction carries no rent history.
|
|
866
|
+
*
|
|
848
867
|
* @example
|
|
849
868
|
* ```ts
|
|
850
869
|
* declare const ctx: SageContext;
|
|
@@ -869,9 +888,10 @@ export async function planFinalizeClaimStakeBuildingChanges(ctx, stake, input) {
|
|
|
869
888
|
fail(`Claim Stake ${stake.address} has a known delinquent rent balance of ${String(stake.rentBalanceRaw)} raw units. Top up rent, refresh the Claim Stake, and retry finalization.`, stake.address);
|
|
870
889
|
}
|
|
871
890
|
const action = 'finalization';
|
|
872
|
-
const [freshGame, loaded] = await Promise.all([
|
|
891
|
+
const [freshGame, loaded, rent] = await Promise.all([
|
|
873
892
|
readFreshGameClaimStakeConfiguration(ctx),
|
|
874
893
|
readOwnedStake(ctx, stake, action, [character]),
|
|
894
|
+
requireDisabledStakeRent(ctx, game, stake.address, action),
|
|
875
895
|
]);
|
|
876
896
|
if (freshGame === undefined) {
|
|
877
897
|
fail(`Configured Game ${game} is missing. Refresh the Game catalog and retry finalization.`, game);
|
|
@@ -908,6 +928,7 @@ export async function planFinalizeClaimStakeBuildingChanges(ctx, stake, input) {
|
|
|
908
928
|
playerPrecondition(playerAccount, player),
|
|
909
929
|
])),
|
|
910
930
|
currencyGuard,
|
|
931
|
+
...rent.guards,
|
|
911
932
|
],
|
|
912
933
|
steps: [
|
|
913
934
|
{
|
|
@@ -920,6 +941,7 @@ export async function planFinalizeClaimStakeBuildingChanges(ctx, stake, input) {
|
|
|
920
941
|
claimStakeInstance: stake.address,
|
|
921
942
|
currencyCache,
|
|
922
943
|
game,
|
|
944
|
+
...rent.accounts,
|
|
923
945
|
systemAndStarbasePlayerStarbasePlayer: player,
|
|
924
946
|
systemAndStarbasePlayerSystem: system,
|
|
925
947
|
}),
|
|
@@ -940,6 +962,10 @@ export async function planFinalizeClaimStakeBuildingChanges(ctx, stake, input) {
|
|
|
940
962
|
* Requires Game 2 and its existing canonical Claim Stake XP ledger.
|
|
941
963
|
* Missing XP state must be repaired outside this Plan; no accounts are created.
|
|
942
964
|
*
|
|
965
|
+
* Requires Disabled rent: the Game's rent catalog and the Claim Stake's rent
|
|
966
|
+
* settlement authority must not exist, and both stay guarded absent until
|
|
967
|
+
* signing. The instruction carries no rent history.
|
|
968
|
+
*
|
|
943
969
|
* @example
|
|
944
970
|
* ```ts
|
|
945
971
|
* declare const ctx: SageContext;
|
|
@@ -960,7 +986,10 @@ export async function planCancelClaimStakeBuildingChanges(ctx, stake, input) {
|
|
|
960
986
|
}
|
|
961
987
|
const character = await requireOwnedStake(stake, game, profile);
|
|
962
988
|
const action = 'cancellation';
|
|
963
|
-
const { bodyAccount, currentBody, currentStake, stakeAccount } = await
|
|
989
|
+
const [{ bodyAccount, currentBody, currentStake, stakeAccount }, rent] = await Promise.all([
|
|
990
|
+
readOwnedStake(ctx, stake, action),
|
|
991
|
+
requireDisabledStakeRent(ctx, game, stake.address, action),
|
|
992
|
+
]);
|
|
964
993
|
if (!sameOwnedStake(currentStake, stake, game, character) ||
|
|
965
994
|
currentStake.state.kind !== 'design' ||
|
|
966
995
|
currentStake.state.sequenceId !== stake.state.sequenceId ||
|
|
@@ -984,6 +1013,7 @@ export async function planCancelClaimStakeBuildingChanges(ctx, stake, input) {
|
|
|
984
1013
|
playerPrecondition(playerAccount, player),
|
|
985
1014
|
])),
|
|
986
1015
|
currencyGuard,
|
|
1016
|
+
...rent.guards,
|
|
987
1017
|
],
|
|
988
1018
|
steps: [
|
|
989
1019
|
{
|
|
@@ -995,6 +1025,7 @@ export async function planCancelClaimStakeBuildingChanges(ctx, stake, input) {
|
|
|
995
1025
|
claimStakeInstance: stake.address,
|
|
996
1026
|
currencyCache,
|
|
997
1027
|
game,
|
|
1028
|
+
...rent.accounts,
|
|
998
1029
|
starbasePlayer: player,
|
|
999
1030
|
system,
|
|
1000
1031
|
}),
|
|
@@ -1013,6 +1044,12 @@ export async function planCancelClaimStakeBuildingChanges(ctx, stake, input) {
|
|
|
1013
1044
|
* Rent settlement, cargo return, account closure, and concurrent races remain
|
|
1014
1045
|
* chain-authoritative; the Plan does not estimate a refund.
|
|
1015
1046
|
*
|
|
1047
|
+
* Requires Disabled rent: the Game's rent catalog and the Claim Stake's rent
|
|
1048
|
+
* settlement authority must not exist, and both stay guarded absent until
|
|
1049
|
+
* signing. The instruction carries no rent history. Deconstruction also
|
|
1050
|
+
* requires the canonical Currency Cache and closes the Claim Stake's XP ledger;
|
|
1051
|
+
* a Claim Stake without a ledger accrued no XP.
|
|
1052
|
+
*
|
|
1016
1053
|
* @example
|
|
1017
1054
|
* ```ts
|
|
1018
1055
|
* declare const ctx: SageContext;
|
|
@@ -1031,9 +1068,10 @@ export async function planDeconstructClaimStake(ctx, stake, input) {
|
|
|
1031
1068
|
}
|
|
1032
1069
|
const character = await requireOwnedStake(stake, game, profile);
|
|
1033
1070
|
const action = 'deconstruction';
|
|
1034
|
-
const [freshGame, { bodyAccount, currentBody, currentStake, stakeAccount }] = await Promise.all([
|
|
1071
|
+
const [freshGame, { bodyAccount, currentBody, currentStake, stakeAccount }, rent,] = await Promise.all([
|
|
1035
1072
|
readFreshGameClaimStakeConfiguration(ctx),
|
|
1036
1073
|
readOwnedStake(ctx, stake, action),
|
|
1074
|
+
requireDisabledStakeRent(ctx, game, stake.address, action),
|
|
1037
1075
|
]);
|
|
1038
1076
|
if (freshGame === undefined) {
|
|
1039
1077
|
fail(`Configured Game ${game} is missing. Refresh the Game definitions and retry deconstruction.`, game);
|
|
@@ -1103,32 +1141,53 @@ export async function planDeconstructClaimStake(ctx, stake, input) {
|
|
|
1103
1141
|
}
|
|
1104
1142
|
const plotLevelIndex = plotCapacities.findIndex((capacity) => claimStakeIndex < capacity);
|
|
1105
1143
|
const claimStakeLevel = CLAIM_STAKE_PLOT_LEVELS[plotLevelIndex];
|
|
1106
|
-
const
|
|
1144
|
+
const [currencyCache, [xpAccrual]] = await Promise.all([
|
|
1145
|
+
claimStakeCurrencyCache(game),
|
|
1146
|
+
deriveStructureXpAccrualAddress(stake.address),
|
|
1147
|
+
]);
|
|
1148
|
+
const { currentSystem, extraAccounts: [characterCandidate, currencyCandidate, ledgerCandidate], player, playerAccount, systemAccount, } = await readStakeStarbase(ctx, stake, game, system, character, profile, action, [character, currencyCache, xpAccrual]);
|
|
1107
1149
|
const { account: characterAccount } = requireProfileCharacter(characterCandidate, character, profile, game, action);
|
|
1150
|
+
const currencyGuard = await requireCurrencyCache(currencyCandidate, currencyCache, game, action, 'Claim Stake deconstruction');
|
|
1151
|
+
// Deconstruction closes an existing XP ledger; a stake without one accrued nothing.
|
|
1152
|
+
const xp = ledgerCandidate === undefined
|
|
1153
|
+
? {
|
|
1154
|
+
accounts: {},
|
|
1155
|
+
guard: accountAbsentPrecondition(xpAccrual, `Claim Stake ${stake.address} XP ledger ${xpAccrual} remains absent, so no Building XP has accrued.`),
|
|
1156
|
+
}
|
|
1157
|
+
: await resolveClaimStakeXp(ctx, game, stake.address, character);
|
|
1108
1158
|
const description = `Deconstruct Claim Stake ${stake.address} and discard its bundled hub ${bundledHub.name}; rent settlement, cargo return, account closure, and any refund remain chain-authoritative.`;
|
|
1109
1159
|
return buildPlannerPlan({
|
|
1110
1160
|
kind: 'claim-stakes.deconstruct',
|
|
1111
|
-
preconditions:
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1161
|
+
preconditions: [
|
|
1162
|
+
...(await Promise.all([
|
|
1163
|
+
accountStatePrecondition(freshGame.account, `The configured Game retains Claim Stake definition ${String(claimDefinition.id)}, bundled hub ${String(bundledHub.id)}, and their current generations.`),
|
|
1164
|
+
accountStatePrecondition(stakeAccount, `Claim Stake ${stake.address} retains its ownership, active state, definitions, bundled hub, Body, and System generation.`),
|
|
1165
|
+
accountStatePrecondition(bodyAccount, `The Planet retains Claim Stake ${stake.address} at chronology index ${String(claimStakeIndex)} in definition group ${String(claimDefinition.id)}.`),
|
|
1166
|
+
characterPrecondition(characterAccount, profile),
|
|
1167
|
+
systemPrecondition(systemAccount, currentSystem.name),
|
|
1168
|
+
playerPrecondition(playerAccount, player),
|
|
1169
|
+
])),
|
|
1170
|
+
currencyGuard,
|
|
1171
|
+
xp.guard,
|
|
1172
|
+
...rent.guards,
|
|
1173
|
+
],
|
|
1119
1174
|
steps: [
|
|
1120
1175
|
{
|
|
1121
1176
|
describes: description,
|
|
1122
1177
|
instruction: adaptDeconstructClaimStakeInstruction({
|
|
1178
|
+
...xp.accounts,
|
|
1123
1179
|
authorization: options.authorization,
|
|
1124
1180
|
celestialBody: stake.body.address,
|
|
1125
1181
|
character,
|
|
1126
1182
|
claimStakeIndex,
|
|
1127
1183
|
claimStakeInstance: stake.address,
|
|
1128
1184
|
claimStakeLevel,
|
|
1185
|
+
currencyCache,
|
|
1129
1186
|
game,
|
|
1187
|
+
...rent.accounts,
|
|
1130
1188
|
systemAndStarbasePlayerStarbasePlayer: player,
|
|
1131
1189
|
systemAndStarbasePlayerSystem: system,
|
|
1190
|
+
xpAccrual,
|
|
1132
1191
|
}),
|
|
1133
1192
|
signers: [options.authorization.authority],
|
|
1134
1193
|
},
|
|
@@ -1143,6 +1202,10 @@ export async function planDeconstructClaimStake(ctx, stake, input) {
|
|
|
1143
1202
|
* known raw ATLAS balance. Permission checks, concurrent balance changes, rent
|
|
1144
1203
|
* arithmetic, and duration purchased remain chain-authoritative.
|
|
1145
1204
|
*
|
|
1205
|
+
* Requires Disabled rent: the Game's rent catalog and the Claim Stake's rent
|
|
1206
|
+
* settlement authority must not exist, and both stay guarded absent until
|
|
1207
|
+
* signing. The instruction carries no rent history.
|
|
1208
|
+
*
|
|
1146
1209
|
* @example
|
|
1147
1210
|
* ```ts
|
|
1148
1211
|
* declare const ctx: SageContext;
|
|
@@ -1165,7 +1228,10 @@ export async function planTopUpClaimStakeRent(ctx, stake, input) {
|
|
|
1165
1228
|
}
|
|
1166
1229
|
const character = await requireOwnedStake(stake, game, profile);
|
|
1167
1230
|
const action = 'the rent top-up';
|
|
1168
|
-
const { bodyAccount, currentBody, currentStake, extraAccounts: [characterCandidate], stakeAccount, } = await
|
|
1231
|
+
const [{ bodyAccount, currentBody, currentStake, extraAccounts: [characterCandidate], stakeAccount, }, rent,] = await Promise.all([
|
|
1232
|
+
readOwnedStake(ctx, stake, action, [character]),
|
|
1233
|
+
requireDisabledStakeRent(ctx, game, stake.address, action),
|
|
1234
|
+
]);
|
|
1169
1235
|
if (!sameOwnedStake(currentStake, stake, game, character) ||
|
|
1170
1236
|
currentStake.rentBalanceRaw !== stake.rentBalanceRaw ||
|
|
1171
1237
|
!sameStakeState(currentStake.state, loadedState)) {
|
|
@@ -1180,13 +1246,16 @@ export async function planTopUpClaimStakeRent(ctx, stake, input) {
|
|
|
1180
1246
|
const description = `Top up Claim Stake ${stake.address} rent with ${String(options.amount)} raw rent units; rent arithmetic remains chain-authoritative.`;
|
|
1181
1247
|
return buildPlannerPlan({
|
|
1182
1248
|
kind: 'claim-stakes.top-up-rent',
|
|
1183
|
-
preconditions:
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1249
|
+
preconditions: [
|
|
1250
|
+
...(await Promise.all([
|
|
1251
|
+
accountStatePrecondition(stakeAccount, `Claim Stake ${stake.address} retains its ownership, rent balance, placed state, Body, and System generation.`),
|
|
1252
|
+
planetPrecondition(bodyAccount, system),
|
|
1253
|
+
accountStatePrecondition(characterAccount, `The canonical Character remains assigned to Profile ${profile} with at least ${String(options.amount)} known raw ATLAS.`),
|
|
1254
|
+
systemPrecondition(systemAccount, currentSystem.name),
|
|
1255
|
+
playerPrecondition(playerAccount, player),
|
|
1256
|
+
])),
|
|
1257
|
+
...rent.guards,
|
|
1258
|
+
],
|
|
1190
1259
|
steps: [
|
|
1191
1260
|
{
|
|
1192
1261
|
describes: description,
|
|
@@ -1197,6 +1266,7 @@ export async function planTopUpClaimStakeRent(ctx, stake, input) {
|
|
|
1197
1266
|
character,
|
|
1198
1267
|
claimStakeInstance: stake.address,
|
|
1199
1268
|
game,
|
|
1269
|
+
...rent.accounts,
|
|
1200
1270
|
systemAndStarbasePlayerStarbasePlayer: player,
|
|
1201
1271
|
systemAndStarbasePlayerSystem: system,
|
|
1202
1272
|
}),
|
|
@@ -1250,6 +1320,10 @@ function describeCargoRequests(direction, requests) {
|
|
|
1250
1320
|
* Requires Game 2 and its existing canonical Claim Stake XP ledger.
|
|
1251
1321
|
* Missing XP state must be repaired outside this Plan; no accounts are created.
|
|
1252
1322
|
*
|
|
1323
|
+
* Requires Disabled rent: the Game's rent catalog and the Claim Stake's rent
|
|
1324
|
+
* settlement authority must not exist, and both stay guarded absent until
|
|
1325
|
+
* signing. The instruction carries no rent history.
|
|
1326
|
+
*
|
|
1253
1327
|
* @example
|
|
1254
1328
|
* ```ts
|
|
1255
1329
|
* declare const ctx: SageContext;
|
|
@@ -1286,7 +1360,10 @@ export async function planStartClaimStakeFleetTransfer(ctx, fleet, stake, input)
|
|
|
1286
1360
|
}
|
|
1287
1361
|
const character = await requireOwnedStake(stake, game, profile);
|
|
1288
1362
|
const action = 'the Fleet transfer';
|
|
1289
|
-
const { bodyAccount, currentBody, currentStake, extraAccounts: [fleetCandidate, characterCandidate], stakeAccount, } = await
|
|
1363
|
+
const [{ bodyAccount, currentBody, currentStake, extraAccounts: [fleetCandidate, characterCandidate], stakeAccount, }, rent,] = await Promise.all([
|
|
1364
|
+
readOwnedStake(ctx, stake, action, [fleet.address, character]),
|
|
1365
|
+
requireDisabledStakeRent(ctx, game, stake.address, action),
|
|
1366
|
+
]);
|
|
1290
1367
|
const fleetAccount = requireAccount(fleetCandidate, fleet.address, `Fleet ${fleet.name} is missing. Refresh it and retry the Fleet transfer.`);
|
|
1291
1368
|
const currentFleet = fleetAccountDefinition.decode(fleetAccount);
|
|
1292
1369
|
if (!Number.isSafeInteger(currentFleet.crewCount) ||
|
|
@@ -1356,6 +1433,7 @@ export async function planStartClaimStakeFleetTransfer(ctx, fleet, stake, input)
|
|
|
1356
1433
|
]),
|
|
1357
1434
|
])),
|
|
1358
1435
|
currencyGuard,
|
|
1436
|
+
...rent.guards,
|
|
1359
1437
|
],
|
|
1360
1438
|
steps: [
|
|
1361
1439
|
{
|
|
@@ -1370,6 +1448,7 @@ export async function planStartClaimStakeFleetTransfer(ctx, fleet, stake, input)
|
|
|
1370
1448
|
currencyCache,
|
|
1371
1449
|
fleet: fleet.address,
|
|
1372
1450
|
game,
|
|
1451
|
+
...rent.accounts,
|
|
1373
1452
|
systemAndStarbasePlayerStarbasePlayer: player,
|
|
1374
1453
|
systemAndStarbasePlayerSystem: system,
|
|
1375
1454
|
toLoad: options.load.map(({ amount, cargoId }) => [cargoId, amount]),
|