@aephia/atlas-kit 0.8.0-next.24 → 0.8.0-next.26
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 +64 -0
- package/dist/claim-stakes/actions/index.d.ts.map +1 -1
- package/dist/claim-stakes/actions/index.js +261 -61
- package/dist/claim-stakes/actions/index.js.map +1 -1
- package/dist/combat/actions/index.d.ts +86 -0
- package/dist/combat/actions/index.d.ts.map +1 -1
- package/dist/combat/actions/index.js +387 -1
- package/dist/combat/actions/index.js.map +1 -1
- package/dist/internal/c4/discriminators.d.ts +4 -0
- package/dist/internal/c4/discriminators.d.ts.map +1 -1
- package/dist/internal/c4/discriminators.js +9 -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 +53 -0
- package/dist/internal/planning/authorization-adapter.d.ts.map +1 -1
- package/dist/internal/planning/authorization-adapter.js +77 -1
- package/dist/internal/planning/authorization-adapter.js.map +1 -1
- 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/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/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/reward-epoch.d.ts +1 -1
- package/dist/internal/planning/reward-epoch.d.ts.map +1 -1
- package/dist/internal/planning/reward-epoch.js +25 -3
- package/dist/internal/planning/reward-epoch.js.map +1 -1
- package/dist/internal/planning/runtime-guards.d.ts.map +1 -1
- package/dist/internal/planning/runtime-guards.js +12 -2
- package/dist/internal/planning/runtime-guards.js.map +1 -1
- package/dist/internal/planning/starbase-repair-guard.d.ts +5 -0
- package/dist/internal/planning/starbase-repair-guard.d.ts.map +1 -1
- package/dist/internal/planning/starbase-repair-guard.js +38 -1
- package/dist/internal/planning/starbase-repair-guard.js.map +1 -1
- package/dist/internal/planning/starbase-system-guard.d.ts.map +1 -1
- package/dist/internal/planning/starbase-system-guard.js +12 -2
- package/dist/internal/planning/starbase-system-guard.js.map +1 -1
- package/dist/planning/execution.d.ts.map +1 -1
- package/dist/planning/execution.js +18 -1
- package/dist/planning/execution.js.map +1 -1
- package/dist/planning/index.d.ts +8 -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 +8 -1
- package/dist/planning/plan-validation.js.map +1 -1
- package/package.json +1 -1
|
@@ -222,6 +222,27 @@ export interface PlanRecoverClaimStakeFleetTransferOptions {
|
|
|
222
222
|
readonly atUnixSeconds: bigint;
|
|
223
223
|
readonly authorization: PlanAuthorization;
|
|
224
224
|
}
|
|
225
|
+
/** Exact inputs for the permissionless normal exit of one elapsed Claim Stake
|
|
226
|
+
* Fleet transfer.
|
|
227
|
+
*
|
|
228
|
+
* `funder` signs the exit, pays any rent shortfall of the Fleet and Claim
|
|
229
|
+
* Stake and receives any rent they free. It need not be the owner's key.
|
|
230
|
+
* `atUnixSeconds` is an explicit non-negative Unix timestamp used to prove the
|
|
231
|
+
* transfer has ended. The planner never reads a local clock.
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```ts
|
|
235
|
+
* declare const funder: Address;
|
|
236
|
+
* const options: PlanExitClaimStakeFleetTransferOptions = {
|
|
237
|
+
* atUnixSeconds: 1_700_000_100n,
|
|
238
|
+
* funder,
|
|
239
|
+
* };
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
export interface PlanExitClaimStakeFleetTransferOptions {
|
|
243
|
+
readonly atUnixSeconds: bigint;
|
|
244
|
+
readonly funder: Address;
|
|
245
|
+
}
|
|
225
246
|
interface FleetSnapshot extends Omit<ResolvedFleetAccountData, 'ownerProfile'> {
|
|
226
247
|
readonly kind: 'fleet';
|
|
227
248
|
readonly address: Address;
|
|
@@ -516,4 +537,47 @@ export declare function planStartClaimStakeFleetTransfer(ctx: SageContext, fleet
|
|
|
516
537
|
* ```
|
|
517
538
|
*/
|
|
518
539
|
export declare function planRecoverClaimStakeFleetTransfer(ctx: SageContext, fleet: FleetSnapshot, stake: ClaimStakeSnapshot, input: PlanRecoverClaimStakeFleetTransferOptions): Promise<Plan>;
|
|
540
|
+
/** Plans the permissionless normal exit of one elapsed Claim Stake Fleet transfer.
|
|
541
|
+
*
|
|
542
|
+
* The exit completes a transfer started with
|
|
543
|
+
* {@link planStartClaimStakeFleetTransfer}: the game accrues the Claim Stake's
|
|
544
|
+
* production, moves the queued loads and unloads, and returns the Fleet to
|
|
545
|
+
* idle. Any signer may exit an elapsed transfer, so the Plan's only signer is
|
|
546
|
+
* the `funder`, which pays any rent shortfall of the Fleet and Claim Stake and
|
|
547
|
+
* receives any rent they free.
|
|
548
|
+
*
|
|
549
|
+
* The planner requires the explicit timestamp to have reached the transfer's
|
|
550
|
+
* end, and the Plan carries a guard that execution checks against the chain
|
|
551
|
+
* Clock and the Fleet's stored end before signing: before the end, the game
|
|
552
|
+
* leaves the Fleet in its transfer while the funder still pays the fee. It
|
|
553
|
+
* requires the Fleet's required crew, the same owner Profile for the Fleet
|
|
554
|
+
* and the active Claim Stake, the canonical Planet, System, active Starbase
|
|
555
|
+
* and owner Starbase Player, and Disabled rent, as the transfer start does.
|
|
556
|
+
*
|
|
557
|
+
* When fresh state shows the queued cargo cannot move (a Fleet-side shortfall
|
|
558
|
+
* or overflow, an invalid queued cargo id, or a Claim Stake shortfall of a
|
|
559
|
+
* resource the stake does not produce), the Plan still exits: the game then
|
|
560
|
+
* returns the Fleet to idle without moving cargo, and the description says
|
|
561
|
+
* so. The game accrues the stake's production before moving cargo, so a
|
|
562
|
+
* stored shortfall of a resource the stake produces, or a stake storage
|
|
563
|
+
* overflow while it consumes a stored resource, is described as depending on that
|
|
564
|
+
* accrual. The game also limits Fuel to the stake's separate fuel storage,
|
|
565
|
+
* which this Plan does not enforce; if the cargo no longer fits then, the exit
|
|
566
|
+
* likewise moves nothing. Use {@link planRecoverClaimStakeFleetTransfer} only
|
|
567
|
+
* when the owner wants to abandon a non-executable transfer instead.
|
|
568
|
+
*
|
|
569
|
+
* @example
|
|
570
|
+
* ```ts
|
|
571
|
+
* declare const ctx: SageContext;
|
|
572
|
+
* declare const fleet: FleetSnapshot;
|
|
573
|
+
* declare const stake: ClaimStakeSnapshot;
|
|
574
|
+
* declare const funder: Address;
|
|
575
|
+
* const plan = await planExitClaimStakeFleetTransfer(ctx, fleet, stake, {
|
|
576
|
+
* atUnixSeconds: 1_700_000_100n,
|
|
577
|
+
* funder,
|
|
578
|
+
* });
|
|
579
|
+
* console.log(plan.describe());
|
|
580
|
+
* ```
|
|
581
|
+
*/
|
|
582
|
+
export declare function planExitClaimStakeFleetTransfer(ctx: SageContext, fleet: FleetSnapshot, stake: ClaimStakeSnapshot, input: PlanExitClaimStakeFleetTransferOptions): Promise<Plan>;
|
|
519
583
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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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W,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"}
|
|
@@ -27,7 +27,7 @@ import { requireProfileStarbasePlayer } from '../../internal/planning/starbase-p
|
|
|
27
27
|
import { requireGameAddress } from '../../internal/game-context.js';
|
|
28
28
|
import { structurePlacementFee } from '../../internal/planning/placement-fee.js';
|
|
29
29
|
import { cargoStorageUnits, cargoStorageUnitsFloor, } from '../../internal/cargo.js';
|
|
30
|
-
import { adaptCancelClaimStakeBuildingChangesInstruction, adaptClaimStakeBuildingChangesInstruction, adaptDeconstructClaimStakeInstruction, adaptFinalizeClaimStakeBuildingChangesInstruction, adaptPlaceClaimStakeInstruction, adaptRecoverClaimStakeFleetTransferInstruction, adaptStartClaimStakeFleetTransferInstruction, adaptTopUpClaimStakeRentInstruction, readPlanAuthorization, } from '../../internal/planning/authorization-adapter.js';
|
|
30
|
+
import { adaptCancelClaimStakeBuildingChangesInstruction, adaptClaimStakeBuildingChangesInstruction, adaptDeconstructClaimStakeInstruction, adaptExitClaimStakeFleetTransferInstruction, adaptFinalizeClaimStakeBuildingChangesInstruction, adaptPlaceClaimStakeInstruction, adaptRecoverClaimStakeFleetTransferInstruction, adaptStartClaimStakeFleetTransferInstruction, adaptTopUpClaimStakeRentInstruction, readPlanAuthorization, } from '../../internal/planning/authorization-adapter.js';
|
|
31
31
|
import { buildPlannerPlan } from '../../planning/plan-construction.js';
|
|
32
32
|
import { readFreshGameCargoDefinitions } from '../../registry/cargo.js';
|
|
33
33
|
import { listClaimStakeBuildingDefinitions, resolveCargo, } from '../../registry/index.js';
|
|
@@ -238,16 +238,28 @@ function validateStartFleetTransferOptions(value) {
|
|
|
238
238
|
}
|
|
239
239
|
return { authorization, load, unload };
|
|
240
240
|
}
|
|
241
|
+
function unixSeconds(value, action) {
|
|
242
|
+
if (typeof value !== 'bigint' || value < 0n || value > U64_MAX) {
|
|
243
|
+
invalid('atUnixSeconds', value, `a non-negative bigint through ${String(U64_MAX)} (unsigned u64 Unix seconds)`, `Set atUnixSeconds to the explicit current Unix timestamp before retrying ${action}.`);
|
|
244
|
+
}
|
|
245
|
+
return value;
|
|
246
|
+
}
|
|
241
247
|
function validateRecoverFleetTransferOptions(value) {
|
|
242
248
|
const options = record(value, 'options');
|
|
243
249
|
exactKeys(options, 'options', ['atUnixSeconds', 'authorization']);
|
|
244
250
|
const authorization = readPlanAuthorization(options.authorization);
|
|
245
|
-
|
|
246
|
-
options.atUnixSeconds
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
+
return {
|
|
252
|
+
atUnixSeconds: unixSeconds(options.atUnixSeconds, 'recovery'),
|
|
253
|
+
authorization,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function validateExitFleetTransferOptions(value) {
|
|
257
|
+
const options = record(value, 'options');
|
|
258
|
+
exactKeys(options, 'options', ['atUnixSeconds', 'funder']);
|
|
259
|
+
return {
|
|
260
|
+
atUnixSeconds: unixSeconds(options.atUnixSeconds, 'the exit'),
|
|
261
|
+
funder: address(options.funder, 'funder'),
|
|
262
|
+
};
|
|
251
263
|
}
|
|
252
264
|
function requireAccount(account, accountAddress, message) {
|
|
253
265
|
return account ?? fail(message, accountAddress);
|
|
@@ -1838,6 +1850,93 @@ export async function planStartClaimStakeFleetTransfer(ctx, fleet, stake, input)
|
|
|
1838
1850
|
summary: description,
|
|
1839
1851
|
});
|
|
1840
1852
|
}
|
|
1853
|
+
/** Proves from fresh state why a queued Claim Stake transfer cannot move its
|
|
1854
|
+
* cargo: a source shortfall, an invalid queued cargo id, or a destination
|
|
1855
|
+
* overflow. `reason` is undefined when the transfer looks executable.
|
|
1856
|
+
*
|
|
1857
|
+
* Recovery judges the stored cargo exactly as it stands. The normal exit
|
|
1858
|
+
* (`accrues`) first accrues the stake's production, so there a stored
|
|
1859
|
+
* Claim Stake shortfall of a resource the stake produces, or a stake storage
|
|
1860
|
+
* overflow while it consumes a stored resource, is only `conditional`: the cargo may
|
|
1861
|
+
* still move after accrual. Fleet-side shortfalls and overflows, invalid
|
|
1862
|
+
* cargo ids, and stake shortfalls of resources it does not produce stay
|
|
1863
|
+
* definite. Neither mode enforces the stake's separate fuel storage. */
|
|
1864
|
+
async function transferBlocker(ctx, game, currentFleet, state, currentStake, action, accrues = false) {
|
|
1865
|
+
const rates = currentStake.production.netResources;
|
|
1866
|
+
const produces = (cargoId) => accrues &&
|
|
1867
|
+
rates.some((rate) => rate.cargoId === cargoId && rate.ratePerSecondRaw > 0n);
|
|
1868
|
+
let reason;
|
|
1869
|
+
let conditional;
|
|
1870
|
+
for (const request of state.load) {
|
|
1871
|
+
const available = cargoAmount(currentStake.production.cargoPod.amounts, request.cargoId);
|
|
1872
|
+
if (available < request.amount) {
|
|
1873
|
+
const shortfall = `Claim Stake source shortfall for cargo id ${String(request.cargoId)}`;
|
|
1874
|
+
if (produces(request.cargoId))
|
|
1875
|
+
conditional ??= shortfall;
|
|
1876
|
+
else {
|
|
1877
|
+
reason = shortfall;
|
|
1878
|
+
break;
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
if (reason === undefined) {
|
|
1883
|
+
for (const request of state.unload) {
|
|
1884
|
+
const available = fleetCargoHoldAmount(currentFleet, request.cargoId);
|
|
1885
|
+
if (available < request.amount) {
|
|
1886
|
+
reason = `Fleet source shortfall for cargo id ${String(request.cargoId)}`;
|
|
1887
|
+
break;
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
let gameAccount;
|
|
1892
|
+
let queuedDefinitions = new Map();
|
|
1893
|
+
if (reason === undefined) {
|
|
1894
|
+
const cargoIds = [
|
|
1895
|
+
...new Set([...state.load, ...state.unload].map(({ cargoId }) => cargoId)),
|
|
1896
|
+
];
|
|
1897
|
+
const freshGame = (await readFreshGameCargoDefinitions(ctx)) ??
|
|
1898
|
+
fail(`Game ${game} is missing. Refresh the configured Game and retry ${action}.`, game);
|
|
1899
|
+
gameAccount = freshGame.account;
|
|
1900
|
+
queuedDefinitions = new Map(freshGame.data.definitions.map((definition) => [
|
|
1901
|
+
definition.id,
|
|
1902
|
+
definition,
|
|
1903
|
+
]));
|
|
1904
|
+
const invalidCargoId = cargoIds.find((cargoId) => !queuedDefinitions.has(cargoId));
|
|
1905
|
+
if (invalidCargoId !== undefined) {
|
|
1906
|
+
reason = `invalid queued cargo id ${String(invalidCargoId)}`;
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
if (reason === undefined) {
|
|
1910
|
+
// Every queued load, including Fuel and Ammunition, targets the cargo hold.
|
|
1911
|
+
const loadCargoStorage = state.load.reduce((total, { amount, cargoId }) => total +
|
|
1912
|
+
cargoStorageUnits(amount, queuedDefinitions.get(cargoId).storageCost), 0n);
|
|
1913
|
+
// Only an overflow the unloads certainly cause, after the loads free
|
|
1914
|
+
// their storage, proves the stake side non-executable.
|
|
1915
|
+
const unloadStorage = state.unload.reduce((total, { amount, cargoId }) => total +
|
|
1916
|
+
cargoStorageUnitsFloor(amount, queuedDefinitions.get(cargoId).storageCost), 0n);
|
|
1917
|
+
if (currentFleet.cargoHold.storageCost + loadCargoStorage >
|
|
1918
|
+
currentFleet.stats.cargo.cargoCapacity) {
|
|
1919
|
+
reason = 'Fleet cargo destination overflow';
|
|
1920
|
+
}
|
|
1921
|
+
else if (currentStake.production.cargoPod.storageCost -
|
|
1922
|
+
loadCargoStorage +
|
|
1923
|
+
unloadStorage >
|
|
1924
|
+
currentStake.production.resourceCapacityRaw) {
|
|
1925
|
+
const overflow = 'Claim Stake resource storage overflow';
|
|
1926
|
+
// Consuming a stored resource during accrual can free stake storage
|
|
1927
|
+
// before the exit moves cargo.
|
|
1928
|
+
if (accrues &&
|
|
1929
|
+
rates.some((rate) => rate.ratePerSecondRaw < 0n &&
|
|
1930
|
+
cargoAmount(currentStake.production.cargoPod.amounts, rate.cargoId) > 0n))
|
|
1931
|
+
conditional ??= overflow;
|
|
1932
|
+
else
|
|
1933
|
+
reason = overflow;
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
return reason === undefined && conditional !== undefined
|
|
1937
|
+
? { conditional, gameAccount, reason }
|
|
1938
|
+
: { gameAccount, reason };
|
|
1939
|
+
}
|
|
1841
1940
|
/** Plans owner-authorized recovery of one provably non-executable Claim Stake transfer.
|
|
1842
1941
|
*
|
|
1843
1942
|
* Recovery is available only after the explicit transfer lock time and only
|
|
@@ -1912,60 +2011,7 @@ export async function planRecoverClaimStakeFleetTransfer(ctx, fleet, stake, inpu
|
|
|
1912
2011
|
if (!sameTransferStake(currentStake, stake, game, options.authorization.profile)) {
|
|
1913
2012
|
fail(`Claim Stake ${stake.address} changed or no longer matches its loaded owner, Game, Body, active state, resources, capacity, or System generation. Refresh it and retry Fleet transfer recovery.`, stake.address);
|
|
1914
2013
|
}
|
|
1915
|
-
|
|
1916
|
-
for (const request of currentFleet.state.load) {
|
|
1917
|
-
const available = cargoAmount(currentStake.production.cargoPod.amounts, request.cargoId);
|
|
1918
|
-
if (available < request.amount) {
|
|
1919
|
-
reason = `Claim Stake source shortfall for cargo id ${String(request.cargoId)}`;
|
|
1920
|
-
break;
|
|
1921
|
-
}
|
|
1922
|
-
}
|
|
1923
|
-
if (reason === undefined) {
|
|
1924
|
-
for (const request of currentFleet.state.unload) {
|
|
1925
|
-
const available = fleetCargoHoldAmount(currentFleet, request.cargoId);
|
|
1926
|
-
if (available < request.amount) {
|
|
1927
|
-
reason = `Fleet source shortfall for cargo id ${String(request.cargoId)}`;
|
|
1928
|
-
break;
|
|
1929
|
-
}
|
|
1930
|
-
}
|
|
1931
|
-
}
|
|
1932
|
-
let gameAccount;
|
|
1933
|
-
let queuedDefinitions = new Map();
|
|
1934
|
-
if (reason === undefined) {
|
|
1935
|
-
const cargoIds = [
|
|
1936
|
-
...new Set([...currentFleet.state.load, ...currentFleet.state.unload].map(({ cargoId }) => cargoId)),
|
|
1937
|
-
];
|
|
1938
|
-
const freshGame = (await readFreshGameCargoDefinitions(ctx)) ??
|
|
1939
|
-
fail(`Game ${game} is missing. Refresh the configured Game and retry Claim Stake transfer recovery.`, game);
|
|
1940
|
-
gameAccount = freshGame.account;
|
|
1941
|
-
queuedDefinitions = new Map(freshGame.data.definitions.map((definition) => [
|
|
1942
|
-
definition.id,
|
|
1943
|
-
definition,
|
|
1944
|
-
]));
|
|
1945
|
-
const invalidCargoId = cargoIds.find((cargoId) => !queuedDefinitions.has(cargoId));
|
|
1946
|
-
if (invalidCargoId !== undefined) {
|
|
1947
|
-
reason = `invalid queued cargo id ${String(invalidCargoId)}`;
|
|
1948
|
-
}
|
|
1949
|
-
}
|
|
1950
|
-
if (reason === undefined) {
|
|
1951
|
-
// Every queued load, including Fuel and Ammunition, targets the cargo hold.
|
|
1952
|
-
const loadCargoStorage = currentFleet.state.load.reduce((total, { amount, cargoId }) => total +
|
|
1953
|
-
cargoStorageUnits(amount, queuedDefinitions.get(cargoId).storageCost), 0n);
|
|
1954
|
-
// Only an overflow the unloads certainly cause, after the loads free
|
|
1955
|
-
// their storage, proves the stake side non-executable.
|
|
1956
|
-
const unloadStorage = currentFleet.state.unload.reduce((total, { amount, cargoId }) => total +
|
|
1957
|
-
cargoStorageUnitsFloor(amount, queuedDefinitions.get(cargoId).storageCost), 0n);
|
|
1958
|
-
if (currentFleet.cargoHold.storageCost + loadCargoStorage >
|
|
1959
|
-
currentFleet.stats.cargo.cargoCapacity) {
|
|
1960
|
-
reason = 'Fleet cargo destination overflow';
|
|
1961
|
-
}
|
|
1962
|
-
else if (currentStake.production.cargoPod.storageCost -
|
|
1963
|
-
loadCargoStorage +
|
|
1964
|
-
unloadStorage >
|
|
1965
|
-
currentStake.production.resourceCapacityRaw) {
|
|
1966
|
-
reason = 'Claim Stake resource storage overflow';
|
|
1967
|
-
}
|
|
1968
|
-
}
|
|
2014
|
+
const { gameAccount, reason } = await transferBlocker(ctx, game, currentFleet, currentFleet.state, currentStake, 'Claim Stake transfer recovery');
|
|
1969
2015
|
if (reason === undefined) {
|
|
1970
2016
|
fail(`Fleet ${fleet.name}'s Claim Stake transfer is currently executable. Use the permissionless normal exit path; recovery is only for a locally proven non-executable transfer.`, fleet.address);
|
|
1971
2017
|
}
|
|
@@ -1996,4 +2042,158 @@ export async function planRecoverClaimStakeFleetTransfer(ctx, fleet, stake, inpu
|
|
|
1996
2042
|
summary: description,
|
|
1997
2043
|
});
|
|
1998
2044
|
}
|
|
2045
|
+
/** Plans the permissionless normal exit of one elapsed Claim Stake Fleet transfer.
|
|
2046
|
+
*
|
|
2047
|
+
* The exit completes a transfer started with
|
|
2048
|
+
* {@link planStartClaimStakeFleetTransfer}: the game accrues the Claim Stake's
|
|
2049
|
+
* production, moves the queued loads and unloads, and returns the Fleet to
|
|
2050
|
+
* idle. Any signer may exit an elapsed transfer, so the Plan's only signer is
|
|
2051
|
+
* the `funder`, which pays any rent shortfall of the Fleet and Claim Stake and
|
|
2052
|
+
* receives any rent they free.
|
|
2053
|
+
*
|
|
2054
|
+
* The planner requires the explicit timestamp to have reached the transfer's
|
|
2055
|
+
* end, and the Plan carries a guard that execution checks against the chain
|
|
2056
|
+
* Clock and the Fleet's stored end before signing: before the end, the game
|
|
2057
|
+
* leaves the Fleet in its transfer while the funder still pays the fee. It
|
|
2058
|
+
* requires the Fleet's required crew, the same owner Profile for the Fleet
|
|
2059
|
+
* and the active Claim Stake, the canonical Planet, System, active Starbase
|
|
2060
|
+
* and owner Starbase Player, and Disabled rent, as the transfer start does.
|
|
2061
|
+
*
|
|
2062
|
+
* When fresh state shows the queued cargo cannot move (a Fleet-side shortfall
|
|
2063
|
+
* or overflow, an invalid queued cargo id, or a Claim Stake shortfall of a
|
|
2064
|
+
* resource the stake does not produce), the Plan still exits: the game then
|
|
2065
|
+
* returns the Fleet to idle without moving cargo, and the description says
|
|
2066
|
+
* so. The game accrues the stake's production before moving cargo, so a
|
|
2067
|
+
* stored shortfall of a resource the stake produces, or a stake storage
|
|
2068
|
+
* overflow while it consumes a stored resource, is described as depending on that
|
|
2069
|
+
* accrual. The game also limits Fuel to the stake's separate fuel storage,
|
|
2070
|
+
* which this Plan does not enforce; if the cargo no longer fits then, the exit
|
|
2071
|
+
* likewise moves nothing. Use {@link planRecoverClaimStakeFleetTransfer} only
|
|
2072
|
+
* when the owner wants to abandon a non-executable transfer instead.
|
|
2073
|
+
*
|
|
2074
|
+
* @example
|
|
2075
|
+
* ```ts
|
|
2076
|
+
* declare const ctx: SageContext;
|
|
2077
|
+
* declare const fleet: FleetSnapshot;
|
|
2078
|
+
* declare const stake: ClaimStakeSnapshot;
|
|
2079
|
+
* declare const funder: Address;
|
|
2080
|
+
* const plan = await planExitClaimStakeFleetTransfer(ctx, fleet, stake, {
|
|
2081
|
+
* atUnixSeconds: 1_700_000_100n,
|
|
2082
|
+
* funder,
|
|
2083
|
+
* });
|
|
2084
|
+
* console.log(plan.describe());
|
|
2085
|
+
* ```
|
|
2086
|
+
*/
|
|
2087
|
+
export async function planExitClaimStakeFleetTransfer(ctx, fleet, stake, input) {
|
|
2088
|
+
const options = validateExitFleetTransferOptions(input);
|
|
2089
|
+
const game = requireGameAddress(ctx);
|
|
2090
|
+
if (fleet.game !== game || stake.game !== game) {
|
|
2091
|
+
fail(`Fleet ${fleet.address} and Claim Stake ${stake.address} must both belong to configured Game ${game}. Refresh both snapshots through this context and retry the exit.`, fleet.game !== game ? fleet.address : stake.address);
|
|
2092
|
+
}
|
|
2093
|
+
if (fleet.state.kind !== 'claimStakeTransfer') {
|
|
2094
|
+
fail(`Fleet ${fleet.name} is ${fleet.state.kind}, not in a Claim Stake transfer. Refresh it and exit only a running Claim Stake transfer.`, fleet.address);
|
|
2095
|
+
}
|
|
2096
|
+
if (fleet.state.claimStake.address !== stake.address ||
|
|
2097
|
+
fleet.state.planet.address !== stake.body.address) {
|
|
2098
|
+
fail(`Fleet ${fleet.name}'s Claim Stake transfer does not reference Claim Stake ${stake.address} and its Body ${stake.body.address}. Supply the transfer's current Claim Stake snapshot and retry the exit.`, fleet.address);
|
|
2099
|
+
}
|
|
2100
|
+
if (options.atUnixSeconds < fleet.state.endAtUnixSeconds) {
|
|
2101
|
+
fail(`Fleet ${fleet.name}'s Claim Stake transfer has not ended at Unix timestamp ${String(options.atUnixSeconds)}; it ends at ${String(fleet.state.endAtUnixSeconds)}. Wait until it ends, provide a current timestamp, and retry the exit.`, fleet.address);
|
|
2102
|
+
}
|
|
2103
|
+
const profile = fleet.ownerProfile.address;
|
|
2104
|
+
if (stake.state.kind !== 'active') {
|
|
2105
|
+
fail(`Claim Stake ${stake.address} is ${stake.state.kind}, but Atlas Kit plans the normal exit only for an active Claim Stake. Restore the stake's rent or finish its design, refresh it, and retry the exit.`, stake.address);
|
|
2106
|
+
}
|
|
2107
|
+
const character = await requireOwnedStake(ctx.programs, stake, game, profile);
|
|
2108
|
+
const action = 'the Claim Stake transfer exit';
|
|
2109
|
+
const [{ bodyAccount, currentBody, currentStake, extraAccounts: [fleetCandidate], stakeAccount, }, rent,] = await Promise.all([
|
|
2110
|
+
readOwnedStake(ctx, stake, action, [fleet.address]),
|
|
2111
|
+
requireDisabledStakeRent(ctx, game, stake.address, action),
|
|
2112
|
+
]);
|
|
2113
|
+
const fleetAccount = requireAccount(fleetCandidate, fleet.address, `Fleet ${fleet.name} is missing. Refresh it and retry the Claim Stake transfer exit.`);
|
|
2114
|
+
const currentFleet = fleetAccountDefinition.decode(fleetAccount, ctx.programs);
|
|
2115
|
+
if (!sameTransferFleet(currentFleet, fleet, game, profile) ||
|
|
2116
|
+
currentFleet.state.kind !== 'claimStakeTransfer' ||
|
|
2117
|
+
currentFleet.state.claimStake !== stake.address ||
|
|
2118
|
+
currentFleet.state.planet !== stake.body.address ||
|
|
2119
|
+
currentFleet.state.endAtUnixSeconds !== fleet.state.endAtUnixSeconds ||
|
|
2120
|
+
!sameCargoAmounts(currentFleet.state.load, fleet.state.load) ||
|
|
2121
|
+
!sameCargoAmounts(currentFleet.state.unload, fleet.state.unload) ||
|
|
2122
|
+
(await deriveFleetAddress(ctx.programs, currentFleet)) !== fleet.address) {
|
|
2123
|
+
fail(`Fleet ${fleet.name} changed or no longer matches its loaded owner, Game, canonical address, Claim Stake transfer snapshot, cargo, or capacities. Refresh it and retry the exit.`, fleet.address);
|
|
2124
|
+
}
|
|
2125
|
+
if (currentFleet.crewCount < currentFleet.stats.misc.requiredCrew) {
|
|
2126
|
+
fail(`Fleet ${fleet.name} has ${String(currentFleet.crewCount)} crew but needs ${String(currentFleet.stats.misc.requiredCrew)}, and the game exits a Claim Stake transfer only for a Fleet with its required crew. Load crew, refresh it, and retry.`, fleet.address);
|
|
2127
|
+
}
|
|
2128
|
+
if (!sameTransferStake(currentStake, stake, game, profile)) {
|
|
2129
|
+
fail(`Claim Stake ${stake.address} changed or no longer matches its loaded owner, Game, Body, active state, resources, capacity, or System generation. Refresh it and retry the exit.`, stake.address);
|
|
2130
|
+
}
|
|
2131
|
+
const { system } = await requireStakePlanet(ctx.programs, currentBody, stake, game, action);
|
|
2132
|
+
const currencyCache = await claimStakeCurrencyCache(ctx.programs, game);
|
|
2133
|
+
const { currentSystem, extraAccounts: [currencyCandidate], player, playerAccount, systemAccount, } = await readStakeStarbase(ctx, stake, game, system, character, profile, action, [currencyCache]);
|
|
2134
|
+
const currencyGuard = await requireCurrencyCache(ctx.programs, currencyCandidate, currencyCache, game, action, 'Claim Stake Fleet transfer exit');
|
|
2135
|
+
const { conditional, gameAccount, reason } = await transferBlocker(ctx, game, currentFleet, currentFleet.state, currentStake, action, true);
|
|
2136
|
+
const xp = await resolveClaimStakeXp(ctx, game);
|
|
2137
|
+
const queued = [
|
|
2138
|
+
...describeCargoRequests('load', currentFleet.state.load.map(({ amount, cargoId }) => ({
|
|
2139
|
+
amount,
|
|
2140
|
+
cargoId,
|
|
2141
|
+
}))),
|
|
2142
|
+
...describeCargoRequests('unload', currentFleet.state.unload.map(({ amount, cargoId }) => ({
|
|
2143
|
+
amount,
|
|
2144
|
+
cargoId,
|
|
2145
|
+
}))),
|
|
2146
|
+
];
|
|
2147
|
+
const outcome = reason !== undefined
|
|
2148
|
+
? `Fresh state shows the queued cargo (${queued.join('; ')}) cannot move (${reason}), so the game is expected to return the Fleet to idle without moving cargo.`
|
|
2149
|
+
: conditional !== undefined
|
|
2150
|
+
? `The stored Claim Stake state shows a ${conditional}, but the game accrues the stake's production first, so the queued cargo (${queued.join('; ')}) moves only if that accrual resolves it; otherwise the Fleet returns to idle without moving cargo. This Plan cannot tell which; the exit returns the Fleet to idle either way.`
|
|
2151
|
+
: `The game accrues the Claim Stake's production, then moves the queued cargo (${queued.join('; ')}) and returns the Fleet to idle. It checks the stake's storage again after accruing production and limits Fuel to the stake's separate fuel storage, which this Plan does not enforce; if the cargo no longer fits, the Fleet returns to idle without moving cargo.`;
|
|
2152
|
+
const description = `Exit fleet ${fleet.name}'s elapsed transfer with Claim Stake ${stake.address}. ${outcome} Funder ${options.funder} signs, pays any rent shortfall of the Fleet and Claim Stake and receives any rent they free.`;
|
|
2153
|
+
return buildPlannerPlan(ctx.programs, {
|
|
2154
|
+
kind: 'claim-stakes.exit-fleet-transfer',
|
|
2155
|
+
preconditions: [
|
|
2156
|
+
xp.guard,
|
|
2157
|
+
...(await Promise.all([
|
|
2158
|
+
accountStatePrecondition(fleetAccount, `Fleet ${fleet.name} retains its owner, normalized crew, cargo and exact elapsed Claim Stake transfer.`),
|
|
2159
|
+
accountStatePrecondition(stakeAccount, `Claim Stake ${stake.address} retains its owner, active state, cargo, capacity, Body, and System generation.`),
|
|
2160
|
+
planetPrecondition(bodyAccount, system),
|
|
2161
|
+
systemPrecondition(systemAccount, currentSystem.name),
|
|
2162
|
+
playerPrecondition(playerAccount, player),
|
|
2163
|
+
...(gameAccount === undefined
|
|
2164
|
+
? []
|
|
2165
|
+
: [
|
|
2166
|
+
accountStatePrecondition(gameAccount, `Game ${game} retains the cargo definitions used to describe the exit.`),
|
|
2167
|
+
]),
|
|
2168
|
+
])),
|
|
2169
|
+
currencyGuard,
|
|
2170
|
+
...rent.guards,
|
|
2171
|
+
{
|
|
2172
|
+
kind: 'claim-stake-transfer-exit-window',
|
|
2173
|
+
address: fleet.address,
|
|
2174
|
+
endsAtUnixSeconds: currentFleet.state.endAtUnixSeconds,
|
|
2175
|
+
describes: `The chain Clock has reached Fleet ${fleet.name}'s transfer end ${String(currentFleet.state.endAtUnixSeconds)} when the exit executes; before then the game leaves the Fleet in its transfer.`,
|
|
2176
|
+
},
|
|
2177
|
+
],
|
|
2178
|
+
steps: [
|
|
2179
|
+
{
|
|
2180
|
+
describes: description,
|
|
2181
|
+
instruction: adaptExitClaimStakeFleetTransferInstruction(ctx.programs, {
|
|
2182
|
+
celestialBody: stake.body.address,
|
|
2183
|
+
claimStakeInstance: stake.address,
|
|
2184
|
+
currencyCache,
|
|
2185
|
+
fleet: fleet.address,
|
|
2186
|
+
funder: options.funder,
|
|
2187
|
+
game,
|
|
2188
|
+
profile,
|
|
2189
|
+
...rent.accounts,
|
|
2190
|
+
systemAndStarbasePlayerStarbasePlayer: player,
|
|
2191
|
+
systemAndStarbasePlayerSystem: system,
|
|
2192
|
+
}),
|
|
2193
|
+
signers: [options.funder],
|
|
2194
|
+
},
|
|
2195
|
+
],
|
|
2196
|
+
summary: description,
|
|
2197
|
+
});
|
|
2198
|
+
}
|
|
1999
2199
|
//# sourceMappingURL=index.js.map
|