@aephia/atlas-kit 0.8.0-next.3 → 0.8.0-next.30
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 +602 -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 +22 -9
- package/dist/crafting/actions/index.d.ts.map +1 -1
- package/dist/crafting/actions/index.js +68 -20
- package/dist/crafting/actions/index.js.map +1 -1
- package/dist/crafting/index.d.ts +22 -3
- package/dist/crafting/index.d.ts.map +1 -1
- package/dist/crafting/index.js +6 -2
- 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 -1
- package/dist/internal/c4/claim-stake.d.ts.map +1 -1
- package/dist/internal/c4/claim-stake.js +28 -1
- 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 +38 -0
- package/dist/internal/c4/crafting-hab-storage.d.ts.map +1 -0
- package/dist/internal/c4/crafting-hab-storage.js +164 -0
- package/dist/internal/c4/crafting-hab-storage.js.map +1 -0
- package/dist/internal/c4/crafting.d.ts +11 -1
- 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 +39 -0
- package/dist/internal/c4/discriminators.d.ts.map +1 -1
- package/dist/internal/c4/discriminators.js +79 -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 +49 -0
- package/dist/internal/c4/fleet.d.ts.map +1 -1
- package/dist/internal/c4/fleet.js +88 -5
- package/dist/internal/c4/fleet.js.map +1 -1
- package/dist/internal/c4/game.d.ts +26 -0
- package/dist/internal/c4/game.d.ts.map +1 -1
- package/dist/internal/c4/game.js +35 -0
- package/dist/internal/c4/game.js.map +1 -1
- package/dist/internal/c4/governance.d.ts +313 -0
- package/dist/internal/c4/governance.d.ts.map +1 -0
- package/dist/internal/c4/governance.js +471 -0
- package/dist/internal/c4/governance.js.map +1 -0
- 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/crafting-process-state.d.ts +16 -3
- package/dist/internal/crafting-process-state.d.ts.map +1 -1
- package/dist/internal/crafting-process-state.js +44 -0
- package/dist/internal/crafting-process-state.js.map +1 -1
- package/dist/internal/fleet.d.ts.map +1 -1
- package/dist/internal/fleet.js +1 -0
- package/dist/internal/fleet.js.map +1 -1
- package/dist/internal/planning/authorization-adapter.d.ts +404 -1
- package/dist/internal/planning/authorization-adapter.d.ts.map +1 -1
- package/dist/internal/planning/authorization-adapter.js +578 -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/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.d.ts.map +1 -1
- package/dist/internal/planning/fleet-state.js +1 -0
- package/dist/internal/planning/fleet-state.js.map +1 -1
- package/dist/internal/planning/governance-storage-actions.d.ts +9 -0
- package/dist/internal/planning/governance-storage-actions.d.ts.map +1 -0
- package/dist/internal/planning/governance-storage-actions.js +89 -0
- package/dist/internal/planning/governance-storage-actions.js.map +1 -0
- 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 +66 -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 +25 -0
- package/dist/internal/planning/storage-action-readers.js.map +1 -1
- package/dist/mining/actions/index.d.ts +6 -1
- package/dist/mining/actions/index.d.ts.map +1 -1
- package/dist/mining/actions/index.js +14 -1
- package/dist/mining/actions/index.js.map +1 -1
- package/dist/mining/exit-fuel.d.ts +47 -0
- package/dist/mining/exit-fuel.d.ts.map +1 -0
- package/dist/mining/exit-fuel.js +47 -0
- package/dist/mining/exit-fuel.js.map +1 -0
- package/dist/mining/index.d.ts +1 -0
- package/dist/mining/index.d.ts.map +1 -1
- package/dist/mining/index.js +1 -0
- package/dist/mining/index.js.map +1 -1
- package/dist/mining/profile.d.ts +2 -1
- package/dist/mining/profile.d.ts.map +1 -1
- package/dist/mining/profile.js +2 -1
- package/dist/mining/profile.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/governance.d.ts +78 -0
- package/dist/starbases/actions/governance.d.ts.map +1 -0
- package/dist/starbases/actions/governance.js +382 -0
- package/dist/starbases/actions/governance.js.map +1 -0
- package/dist/starbases/actions/index.d.ts +3 -1
- package/dist/starbases/actions/index.d.ts.map +1 -1
- package/dist/starbases/actions/index.js +3 -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 +445 -0
- package/dist/starbases/governance.d.ts.map +1 -0
- package/dist/starbases/governance.js +503 -0
- package/dist/starbases/governance.js.map +1 -0
- package/dist/starbases/index.d.ts +1 -0
- package/dist/starbases/index.d.ts.map +1 -1
- package/dist/starbases/index.js +1 -0
- package/dist/starbases/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AccountRole, isAddress, } from '@solana/kit';
|
|
2
2
|
import { InvalidActionInputError } from '../../client/errors.js';
|
|
3
|
-
import { OrderSide, getAddShipEscrowInstructionDataEncoder, getApplyCombatStimulantInstructionDataEncoder, getAttackFleetInstructionDataEncoder, getAttackStarbaseInstructionDataEncoder, getCancelClaimStakeBuildingDesignInstructionDataEncoder, getCancelCraftingProcessInstructionDataEncoder, getCancelLocalMarketOrdersInstructionDataEncoder, getClaimLoyaltyAtlasInstructionDataEncoder, getClaimStakesRentTopUpInstructionDataEncoder, getCompleteCraftingProcessInstructionDataEncoder, getDeconstructClaimStakeInstanceInstructionDataEncoder, getDepositCargoToGameInstructionDataEncoder, getDockedToIdleInstructionDataEncoder, getFinalizeBuildingChangesInstructionDataEncoder, getIdleToDockedInstructionDataEncoder, getPlaceClaimStakeBuildingsInstructionDataEncoder, getPlaceClaimStakeInstanceWithHubInstructionDataEncoder, getPlaceLocalMarketOrderInstructionDataEncoder, getRecoverClaimStakesFleetTransferInstructionDataEncoder, getDestroyStarbasePlayerInstructionDataEncoder, getRegisterStarbasePlayerInstructionDataEncoder, getRetrieveLootInstructionDataEncoder, getStartClaimStakesFleetTransferInstructionDataEncoder, getStartCraftingProcessInstructionDataEncoder, getStartMiningAsteroidInstructionDataEncoder, getStartSubwarpInstructionDataEncoder, getStopMiningAsteroidInstructionDataEncoder, getStopSubwarpInstructionDataEncoder, getTransferCargoToFleetInstructionDataEncoder, getTransferCargoWithinFleetInstructionDataEncoder, getUnlockResearchNodeInstructionDataEncoder, getWarpLaneInstructionDataEncoder, getWarpToCoordinateInstructionDataEncoder, getWithdrawCargoFromGameInstructionDataEncoder, } from '../c4/runtime-bindings.js';
|
|
3
|
+
import { OrderSide, getAddShipEscrowInstructionDataEncoder, getApplyCombatStimulantInstructionDataEncoder, getAttackFleetInstructionDataEncoder, getAttackStarbaseInstructionDataEncoder, getCancelClaimStakeBuildingDesignInstructionDataEncoder, getCancelCraftingProcessInstructionDataEncoder, getCancelLocalMarketOrdersInstructionDataEncoder, getClaimLoyaltyAtlasInstructionDataEncoder, getContributeGovernanceModuleInstructionDataEncoder, getInitGovernanceModuleProjectInstructionDataEncoder, getContributeToStarbaseUpgradeInstructionDataEncoder, getCancelStarbaseUpgradeContributionInstructionDataEncoder, getInstallStarbaseUpgradeResourceInstructionDataEncoder, getInitLoyaltyEpochInstructionDataEncoder, getInitLoyaltyContributionInstructionDataEncoder, getReloadFleetApInstructionDataEncoder, getRepairDockedFleetInstructionDataEncoder, getRepairIdleFleetInstructionDataEncoder, getRepairStarbaseInstructionDataEncoder, getSettleClaimStakeBuildingXpInstructionDataEncoder, getSettleHabBuildingXpInstructionDataEncoder, getRefundGovernanceModuleContributionInstructionDataEncoder, getClaimStakesRentTopUpInstructionDataEncoder, getCompleteCraftingProcessInstructionDataEncoder, getDeconstructClaimStakeInstanceInstructionDataEncoder, getDailyCheckInInstructionDataEncoder, getDepositCargoToGameInstructionDataEncoder, getDockedToIdleInstructionDataEncoder, getFinalizeBuildingChangesInstructionDataEncoder, getIdleToDockedInstructionDataEncoder, getPlaceClaimStakeBuildingsInstructionDataEncoder, getPlaceClaimStakeInstanceWithHubInstructionDataEncoder, getPlaceLocalMarketOrderInstructionDataEncoder, getExitClaimStakesFleetTransferInstructionDataEncoder, getClaimStakesResourceProductionInstructionDataEncoder, getRecoverClaimStakesFleetTransferInstructionDataEncoder, getDestroyStarbasePlayerInstructionDataEncoder, getRegisterStarbasePlayerInstructionDataEncoder, getRetrieveLootInstructionDataEncoder, getStartClaimStakesFleetTransferInstructionDataEncoder, getStartCraftingProcessInstructionDataEncoder, getStartMiningAsteroidInstructionDataEncoder, getStartSubwarpInstructionDataEncoder, getStopMiningAsteroidInstructionDataEncoder, getStopSubwarpInstructionDataEncoder, getTransferCargoToFleetInstructionDataEncoder, getTransferCargoWithinFleetInstructionDataEncoder, getUnlockResearchNodeInstructionDataEncoder, getWarpLaneInstructionDataEncoder, getWarpToCoordinateInstructionDataEncoder, getWithdrawCargoFromGameInstructionDataEncoder, getInitDemocracyPtrAllocationInstructionDataEncoder, getRequestDemocracyPtrAllocationInstructionDataEncoder, getDepositDemocracyPtrBackingInstructionDataEncoder, getReleaseDemocracyPtrBackingInstructionDataEncoder, getSettleDemocracyPtrAllocationInstructionDataEncoder, getPlaceCraftingHabInstanceInstructionDataEncoder, getCraftingHabRentTopUpInstructionDataEncoder, getDeconstructCraftingHabInstanceInstructionDataEncoder, getPlaceCraftingHabBuildingsInstructionDataEncoder, getFinalizeHabBuildingChangesInstructionDataEncoder, getCancelHabBuildingDesignInstructionDataEncoder, } from '../c4/runtime-bindings.js';
|
|
4
4
|
import { SYSTEM_PROGRAM } from '../system-program.js';
|
|
5
5
|
import { THE_ONE_FLEET_STATE_HANDLER_DISCRIMINATOR } from '../c4/discriminators.js';
|
|
6
6
|
import { ORIGINAL_TOKEN_PROGRAM } from './original-token.js';
|
|
@@ -234,6 +234,24 @@ export function adaptUnlockResearchNodeInstruction(programs, input, config = {})
|
|
|
234
234
|
});
|
|
235
235
|
return createAddressOnlyInstruction(programAddress, accounts, data);
|
|
236
236
|
}
|
|
237
|
+
/** Adapts one daily check-in: the Profile key, the Character, the Currency
|
|
238
|
+
* Cache only when a missed-day streak is restored, and the Game. A restore
|
|
239
|
+
* carries its exact ATLAS cost, which the game checks. */
|
|
240
|
+
export function adaptDailyCheckInInstruction(programs, input, config = {}) {
|
|
241
|
+
const programAddress = getProgramAddress(programs, config);
|
|
242
|
+
const accounts = [
|
|
243
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
244
|
+
writableAccount(input.character),
|
|
245
|
+
optionalWritableAccount(input.restore?.currencyCache, programAddress),
|
|
246
|
+
readonlyAccount(input.game),
|
|
247
|
+
];
|
|
248
|
+
const data = getDailyCheckInInstructionDataEncoder().encode({
|
|
249
|
+
keyIndex: input.authorization.keyIndex,
|
|
250
|
+
restoreStreak: input.restore !== undefined,
|
|
251
|
+
expectedRestoreCost: input.restore?.costRaw ?? null,
|
|
252
|
+
});
|
|
253
|
+
return createAddressOnlyInstruction(programAddress, accounts, data);
|
|
254
|
+
}
|
|
237
255
|
/** Adapts start-crafting with address-only Profile and new-process signers. */
|
|
238
256
|
export function adaptStartCraftingProcessInstruction(programs, input, config = {}) {
|
|
239
257
|
const programAddress = getProgramAddress(programs, config);
|
|
@@ -639,6 +657,49 @@ export function adaptTopUpClaimStakeRentInstruction(programs, input, config = {}
|
|
|
639
657
|
});
|
|
640
658
|
return createAddressOnlyInstruction(programAddress, accounts, data);
|
|
641
659
|
}
|
|
660
|
+
/** Adapts settling a Claim Stake's Building XP with address-only Profile
|
|
661
|
+
* authorization while rent is Disabled. */
|
|
662
|
+
export function adaptSettleClaimStakeBuildingXpInstruction(programs, input, config = {}) {
|
|
663
|
+
const programAddress = getProgramAddress(programs, config);
|
|
664
|
+
const accounts = [
|
|
665
|
+
readonlyAccount(input.game),
|
|
666
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
667
|
+
writableAccount(input.character),
|
|
668
|
+
writableAccount(input.claimStakeInstance),
|
|
669
|
+
readonlyAccount(input.systemAndStarbasePlayerSystem),
|
|
670
|
+
readonlyAccount(input.systemAndStarbasePlayerStarbasePlayer),
|
|
671
|
+
writableAccount(input.celestialBody),
|
|
672
|
+
writableAccount(input.currencyCache),
|
|
673
|
+
writableAccount(input.xpBudget),
|
|
674
|
+
readonlyAccount(input.xpBudgetConfig),
|
|
675
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
676
|
+
...disabledRentAccounts(input, programAddress),
|
|
677
|
+
];
|
|
678
|
+
const data = getSettleClaimStakeBuildingXpInstructionDataEncoder().encode({
|
|
679
|
+
keyIndex: input.authorization.keyIndex,
|
|
680
|
+
rentHints: [...DISABLED_RENT_HINTS],
|
|
681
|
+
});
|
|
682
|
+
return createAddressOnlyInstruction(programAddress, accounts, data);
|
|
683
|
+
}
|
|
684
|
+
/** Adapts settling a Crafting Hab's Building XP with address-only Profile
|
|
685
|
+
* authorization. */
|
|
686
|
+
export function adaptSettleCraftingHabBuildingXpInstruction(programs, input, config = {}) {
|
|
687
|
+
const programAddress = getProgramAddress(programs, config);
|
|
688
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
689
|
+
readonlyAccount(input.game),
|
|
690
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
691
|
+
writableAccount(input.character),
|
|
692
|
+
writableAccount(input.craftingHab),
|
|
693
|
+
readonlyAccount(input.system),
|
|
694
|
+
readonlyAccount(input.starbasePlayer),
|
|
695
|
+
writableAccount(input.currencyCache),
|
|
696
|
+
writableAccount(input.xpBudget),
|
|
697
|
+
readonlyAccount(input.xpBudgetConfig),
|
|
698
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
699
|
+
], getSettleHabBuildingXpInstructionDataEncoder().encode({
|
|
700
|
+
keyIndex: input.authorization.keyIndex,
|
|
701
|
+
}));
|
|
702
|
+
}
|
|
642
703
|
/** Adapts a Claim Stake/Fleet transfer start with address-only Profile authorization. */
|
|
643
704
|
export function adaptStartClaimStakeFleetTransferInstruction(programs, input, config = {}) {
|
|
644
705
|
const programAddress = getProgramAddress(programs, config);
|
|
@@ -678,6 +739,55 @@ export function adaptRecoverClaimStakeFleetTransferInstruction(programs, input,
|
|
|
678
739
|
});
|
|
679
740
|
return createAddressOnlyInstruction(programAddress, accounts, data);
|
|
680
741
|
}
|
|
742
|
+
/** Adapts the normal Claim Stake/Fleet transfer exit. The funder is the only
|
|
743
|
+
* signer; the owner Profile, Claim Stake and Fleet are writable non-signers.
|
|
744
|
+
* The retired Building XP ledger and the Disabled-rent heads use the program
|
|
745
|
+
* placeholder, and the rent hints are the Disabled defaults. */
|
|
746
|
+
export function adaptExitClaimStakeFleetTransferInstruction(programs, input, config = {}) {
|
|
747
|
+
const programAddress = getProgramAddress(programs, config);
|
|
748
|
+
const accounts = [
|
|
749
|
+
writableSignerAddress(input.funder),
|
|
750
|
+
writableAccount(input.profile),
|
|
751
|
+
writableAccount(input.claimStakeInstance),
|
|
752
|
+
writableAccount(input.celestialBody),
|
|
753
|
+
writableAccount(input.fleet),
|
|
754
|
+
readonlyAccount(input.systemAndStarbasePlayerSystem),
|
|
755
|
+
readonlyAccount(input.systemAndStarbasePlayerStarbasePlayer),
|
|
756
|
+
writableAccount(input.currencyCache),
|
|
757
|
+
readonlyAccount(input.game),
|
|
758
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
759
|
+
retiredXpAccrualAccount(programAddress),
|
|
760
|
+
...disabledRentAccounts(input, programAddress),
|
|
761
|
+
];
|
|
762
|
+
const data = getExitClaimStakesFleetTransferInstructionDataEncoder().encode({
|
|
763
|
+
rentHints: [...DISABLED_RENT_HINTS],
|
|
764
|
+
});
|
|
765
|
+
return createAddressOnlyInstruction(programAddress, accounts, data);
|
|
766
|
+
}
|
|
767
|
+
/** Adapts the permissionless Claim Stake production tick. The funder is the
|
|
768
|
+
* only signer; the owner Profile, Claim Stake and Planet are writable
|
|
769
|
+
* non-signers. The retired Building XP ledger and the Disabled-rent heads use
|
|
770
|
+
* the program placeholder, and the rent hints are the Disabled defaults. */
|
|
771
|
+
export function adaptClaimStakeResourceProductionInstruction(programs, input, config = {}) {
|
|
772
|
+
const programAddress = getProgramAddress(programs, config);
|
|
773
|
+
const accounts = [
|
|
774
|
+
writableSignerAddress(input.funder),
|
|
775
|
+
writableAccount(input.profile),
|
|
776
|
+
writableAccount(input.claimStakeInstance),
|
|
777
|
+
writableAccount(input.celestialBody),
|
|
778
|
+
readonlyAccount(input.systemAndStarbasePlayerSystem),
|
|
779
|
+
readonlyAccount(input.systemAndStarbasePlayerStarbasePlayer),
|
|
780
|
+
writableAccount(input.currencyCache),
|
|
781
|
+
readonlyAccount(input.game),
|
|
782
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
783
|
+
retiredXpAccrualAccount(programAddress),
|
|
784
|
+
...disabledRentAccounts(input, programAddress),
|
|
785
|
+
];
|
|
786
|
+
const data = getClaimStakesResourceProductionInstructionDataEncoder().encode({
|
|
787
|
+
rentHints: [...DISABLED_RENT_HINTS],
|
|
788
|
+
});
|
|
789
|
+
return createAddressOnlyInstruction(programAddress, accounts, data);
|
|
790
|
+
}
|
|
681
791
|
export function adaptStartSubwarpInstruction(programs, input, config = {}) {
|
|
682
792
|
const programAddress = getProgramAddress(programs, config);
|
|
683
793
|
const accounts = [
|
|
@@ -867,4 +977,471 @@ export function adaptStopMiningAsteroidInstruction(programs, input, config = {})
|
|
|
867
977
|
keyIndex: input.authorization.keyIndex,
|
|
868
978
|
}));
|
|
869
979
|
}
|
|
980
|
+
/** Adapts the permissionless opening of a System generation's Governance
|
|
981
|
+
* Module project, its rent paid by a wallet funder. */
|
|
982
|
+
export function adaptInitGovernanceModuleProjectInstruction(programs, input, config = {}) {
|
|
983
|
+
const programAddress = getProgramAddress(programs, config);
|
|
984
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
985
|
+
writableSignerAddress(input.funder),
|
|
986
|
+
readonlyAccount(input.game),
|
|
987
|
+
readonlyAccount(input.system),
|
|
988
|
+
readonlyAccount(input.history),
|
|
989
|
+
readonlyAccount(input.policy),
|
|
990
|
+
writableAccount(input.project),
|
|
991
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
992
|
+
], getInitGovernanceModuleProjectInstructionDataEncoder().encode({
|
|
993
|
+
ownershipGeneration: input.ownershipGeneration,
|
|
994
|
+
}));
|
|
995
|
+
}
|
|
996
|
+
/** Adapts a Governance Module contribution with address-only Profile
|
|
997
|
+
* authorization. */
|
|
998
|
+
export function adaptContributeGovernanceModuleInstruction(programs, input, config = {}) {
|
|
999
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1000
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1001
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1002
|
+
readonlyAccount(input.game),
|
|
1003
|
+
readonlyAccount(input.system),
|
|
1004
|
+
writableAccount(input.character),
|
|
1005
|
+
writableAccount(input.starbasePlayer),
|
|
1006
|
+
readonlyAccount(input.history),
|
|
1007
|
+
readonlyAccount(input.policy),
|
|
1008
|
+
writableAccount(input.project),
|
|
1009
|
+
writableAccount(input.contribution),
|
|
1010
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
1011
|
+
// Only a faction with an operator needs its Faction Account here.
|
|
1012
|
+
readonlyAccount(programAddress),
|
|
1013
|
+
], getContributeGovernanceModuleInstructionDataEncoder().encode({
|
|
1014
|
+
keyIndex: input.authorization.keyIndex,
|
|
1015
|
+
expectedRevision: input.expectedRevision,
|
|
1016
|
+
resourceIndex: input.resourceIndex,
|
|
1017
|
+
quantity: input.quantity,
|
|
1018
|
+
crew: input.crew,
|
|
1019
|
+
}));
|
|
1020
|
+
}
|
|
1021
|
+
/** Adapts a refund of an escrowed Governance Module contribution with
|
|
1022
|
+
* address-only Profile authorization. */
|
|
1023
|
+
export function adaptRefundGovernanceModuleContributionInstruction(programs, input, config = {}) {
|
|
1024
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1025
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1026
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1027
|
+
readonlyAccount(input.game),
|
|
1028
|
+
readonlyAccount(input.system),
|
|
1029
|
+
writableAccount(input.character),
|
|
1030
|
+
writableAccount(input.starbasePlayer),
|
|
1031
|
+
readonlyAccount(input.policy),
|
|
1032
|
+
writableAccount(input.project),
|
|
1033
|
+
writableAccount(input.contribution),
|
|
1034
|
+
], getRefundGovernanceModuleContributionInstructionDataEncoder().encode({
|
|
1035
|
+
keyIndex: input.authorization.keyIndex,
|
|
1036
|
+
expectedRevision: input.expectedRevision,
|
|
1037
|
+
}));
|
|
1038
|
+
}
|
|
1039
|
+
function positionAccounts(position) {
|
|
1040
|
+
return [
|
|
1041
|
+
readonlyAccount(position.game),
|
|
1042
|
+
readonlyAccount(position.identity),
|
|
1043
|
+
writableAccount(position.root),
|
|
1044
|
+
writableAccount(position.allocation),
|
|
1045
|
+
writableAccount(position.allocationHistory),
|
|
1046
|
+
writableAccount(position.generation),
|
|
1047
|
+
];
|
|
1048
|
+
}
|
|
1049
|
+
/** Adapts opening a Democracy allocation in a System generation, its rent
|
|
1050
|
+
* paid from the Profile. */
|
|
1051
|
+
export function adaptInitDemocracyAllocationInstruction(programs, input, config = {}) {
|
|
1052
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1053
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1054
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1055
|
+
readonlyAccount(input.game),
|
|
1056
|
+
readonlyAccount(input.identity),
|
|
1057
|
+
writableAccount(input.root),
|
|
1058
|
+
readonlyAccount(input.history),
|
|
1059
|
+
readonlyAccount(input.generation),
|
|
1060
|
+
writableAccount(input.allocation),
|
|
1061
|
+
writableAccount(input.allocationHistory),
|
|
1062
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
1063
|
+
readonlyAccount(input.moduleStatus),
|
|
1064
|
+
], getInitDemocracyPtrAllocationInstructionDataEncoder().encode({
|
|
1065
|
+
keyIndex: input.authorization.keyIndex,
|
|
1066
|
+
expectedAuthorizationRevision: input.expectedAuthorizationRevision,
|
|
1067
|
+
expectedRootRevision: input.expectedRootRevision,
|
|
1068
|
+
}));
|
|
1069
|
+
}
|
|
1070
|
+
/** Adapts requesting a Democracy allocation's voting power and vote. A
|
|
1071
|
+
* positive target names the Starbase Player and the requirement accounts; a
|
|
1072
|
+
* zero target omits them. */
|
|
1073
|
+
export function adaptRequestDemocracyAllocationInstruction(programs, input, config = {}) {
|
|
1074
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1075
|
+
const requirements = input.requirements;
|
|
1076
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1077
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1078
|
+
...positionAccounts(input.position),
|
|
1079
|
+
readonlyAccount(input.history),
|
|
1080
|
+
readonlyAccount(input.policy),
|
|
1081
|
+
optionalReadonlyAccount(requirements?.starbasePlayer, programAddress),
|
|
1082
|
+
// Only a faction with an operator needs its Faction Account here.
|
|
1083
|
+
readonlyAccount(programAddress),
|
|
1084
|
+
optionalWritableAccount(requirements?.registry, programAddress),
|
|
1085
|
+
optionalReadonlyAccount(requirements?.curve, programAddress),
|
|
1086
|
+
optionalReadonlyAccount(requirements?.housingMap, programAddress),
|
|
1087
|
+
optionalReadonlyAccount(requirements?.activeCurve, programAddress),
|
|
1088
|
+
optionalReadonlyAccount(requirements?.activeHousingMap, programAddress),
|
|
1089
|
+
readonlyAccount(input.moduleStatus),
|
|
1090
|
+
], getRequestDemocracyPtrAllocationInstructionDataEncoder().encode({
|
|
1091
|
+
keyIndex: input.authorization.keyIndex,
|
|
1092
|
+
expectedAuthorizationRevision: input.revisions.authorization,
|
|
1093
|
+
expectedRootRevision: input.revisions.root,
|
|
1094
|
+
expectedAllocationRevision: input.revisions.allocation,
|
|
1095
|
+
expectedBackingRevision: input.expectedBackingRevision,
|
|
1096
|
+
targetPvp: input.targetVotingPower,
|
|
1097
|
+
preference: input.vote ?? null,
|
|
1098
|
+
}));
|
|
1099
|
+
}
|
|
1100
|
+
/** Adapts depositing crew and CSS Housing from a Starbase Player as backing
|
|
1101
|
+
* for a Democracy allocation. The Starbase Player's Profile signs as source. */
|
|
1102
|
+
export function adaptDepositDemocracyBackingInstruction(programs, input, config = {}) {
|
|
1103
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1104
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1105
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1106
|
+
...authorizationAccounts(programs, { authorization: input.source }, programAddress),
|
|
1107
|
+
...positionAccounts(input.position),
|
|
1108
|
+
readonlyAccount(input.history),
|
|
1109
|
+
readonlyAccount(input.route),
|
|
1110
|
+
readonlyAccount(input.system),
|
|
1111
|
+
writableAccount(input.starbasePlayer),
|
|
1112
|
+
writableAccount(input.backing),
|
|
1113
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
1114
|
+
readonlyAccount(input.moduleStatus),
|
|
1115
|
+
], getDepositDemocracyPtrBackingInstructionDataEncoder().encode({
|
|
1116
|
+
currentKeyIndex: input.authorization.keyIndex,
|
|
1117
|
+
sourceKeyIndex: input.source.keyIndex,
|
|
1118
|
+
expectedAuthorizationRevision: input.revisions.authorization,
|
|
1119
|
+
expectedRootRevision: input.revisions.root,
|
|
1120
|
+
expectedAllocationRevision: input.revisions.allocation,
|
|
1121
|
+
expectedBackingRevision: input.expectedBackingRevision,
|
|
1122
|
+
crew: input.crew,
|
|
1123
|
+
housingQuantities: [...input.housingQuantities],
|
|
1124
|
+
}));
|
|
1125
|
+
}
|
|
1126
|
+
/** Adapts releasing one Democracy backing deposit back to its Starbase
|
|
1127
|
+
* Player. */
|
|
1128
|
+
export function adaptReleaseDemocracyBackingInstruction(programs, input, config = {}) {
|
|
1129
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1130
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1131
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1132
|
+
...positionAccounts(input.position),
|
|
1133
|
+
writableAccount(input.backing),
|
|
1134
|
+
writableAccount(input.starbasePlayer),
|
|
1135
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
1136
|
+
], getReleaseDemocracyPtrBackingInstructionDataEncoder().encode({
|
|
1137
|
+
keyIndex: input.authorization.keyIndex,
|
|
1138
|
+
expectedAuthorizationRevision: input.revisions.authorization,
|
|
1139
|
+
expectedRootRevision: input.revisions.root,
|
|
1140
|
+
expectedAllocationRevision: input.revisions.allocation,
|
|
1141
|
+
expectedBackingRevision: input.expectedBackingRevision,
|
|
1142
|
+
}));
|
|
1143
|
+
}
|
|
1144
|
+
/** Adapts the permissionless settlement of a Democracy allocation's requested
|
|
1145
|
+
* voting power, its receipt rent paid by a wallet funder. */
|
|
1146
|
+
export function adaptSettleDemocracyAllocationInstruction(programs, input, config = {}) {
|
|
1147
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1148
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1149
|
+
writableSignerAddress(input.funder),
|
|
1150
|
+
...positionAccounts(input.position),
|
|
1151
|
+
readonlyAccount(input.history),
|
|
1152
|
+
optionalReadonlyAccount(input.boundary, programAddress),
|
|
1153
|
+
writableAccount(input.settlement),
|
|
1154
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
1155
|
+
], getSettleDemocracyPtrAllocationInstructionDataEncoder().encode({
|
|
1156
|
+
expectedRootRevision: input.expectedRootRevision,
|
|
1157
|
+
expectedAllocationRevision: input.expectedAllocationRevision,
|
|
1158
|
+
}));
|
|
1159
|
+
}
|
|
1160
|
+
/** Adapts placing a Crafting Hab on a Starbase plot. The new Hab account is a
|
|
1161
|
+
* caller-generated keypair that signs; the Profile funds its storage and the
|
|
1162
|
+
* Character pays the placement fee and any initial rent. */
|
|
1163
|
+
export function adaptPlaceCraftingHabInstruction(programs, input, config = {}) {
|
|
1164
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1165
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1166
|
+
readonlyAccount(input.game),
|
|
1167
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1168
|
+
readonlyAccount(input.profileFaction),
|
|
1169
|
+
writableSignerAddress(input.craftingHab),
|
|
1170
|
+
writableAccount(input.system),
|
|
1171
|
+
writableAccount(input.starbasePlayer),
|
|
1172
|
+
writableAccount(input.character),
|
|
1173
|
+
writableAccount(input.currencyCache),
|
|
1174
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
1175
|
+
readonlyAccount(input.regionBuildingPolicy),
|
|
1176
|
+
], getPlaceCraftingHabInstanceInstructionDataEncoder().encode({
|
|
1177
|
+
keyIndex: input.authorization.keyIndex,
|
|
1178
|
+
craftingHabDefinitionId: input.definitionId,
|
|
1179
|
+
initialRentAmount: input.initialRentRaw ?? null,
|
|
1180
|
+
}));
|
|
1181
|
+
}
|
|
1182
|
+
/** Adapts topping up a Crafting Hab's rent from the Character's ATLAS. */
|
|
1183
|
+
export function adaptCraftingHabRentTopUpInstruction(programs, input, config = {}) {
|
|
1184
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1185
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1186
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1187
|
+
writableAccount(input.character),
|
|
1188
|
+
writableAccount(input.craftingHab),
|
|
1189
|
+
readonlyAccount(input.system),
|
|
1190
|
+
readonlyAccount(input.starbasePlayer),
|
|
1191
|
+
readonlyAccount(input.game),
|
|
1192
|
+
], getCraftingHabRentTopUpInstructionDataEncoder().encode({
|
|
1193
|
+
keyIndex: input.authorization.keyIndex,
|
|
1194
|
+
amount: input.amountRaw,
|
|
1195
|
+
}));
|
|
1196
|
+
}
|
|
1197
|
+
/** Adapts deconstructing a Crafting Hab: the game closes it, returns its Hab
|
|
1198
|
+
* item and any remaining rent, and frees its plot. */
|
|
1199
|
+
export function adaptDeconstructCraftingHabInstruction(programs, input, config = {}) {
|
|
1200
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1201
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1202
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1203
|
+
writableAccount(input.character),
|
|
1204
|
+
readonlyAccount(input.game),
|
|
1205
|
+
writableAccount(input.craftingHab),
|
|
1206
|
+
writableAccount(input.system),
|
|
1207
|
+
writableAccount(input.starbasePlayer),
|
|
1208
|
+
writableAccount(input.currencyCache),
|
|
1209
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
1210
|
+
], getDeconstructCraftingHabInstanceInstructionDataEncoder().encode({
|
|
1211
|
+
keyIndex: input.authorization.keyIndex,
|
|
1212
|
+
craftingHabLevel: input.plotLevel,
|
|
1213
|
+
craftingHabIndex: input.plotIndex,
|
|
1214
|
+
}));
|
|
1215
|
+
}
|
|
1216
|
+
/** Adapts recording building changes in a Crafting Hab's design. The current
|
|
1217
|
+
* game keeps no per-structure XP history, so the XP accrual slot carries the
|
|
1218
|
+
* absent-account placeholder. */
|
|
1219
|
+
export function adaptCraftingHabBuildingChangesInstruction(programs, input, config = {}) {
|
|
1220
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1221
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1222
|
+
readonlyAccount(input.game),
|
|
1223
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1224
|
+
readonlyAccount(input.profileFaction),
|
|
1225
|
+
writableAccount(input.craftingHab),
|
|
1226
|
+
readonlyAccount(input.system),
|
|
1227
|
+
writableAccount(input.starbasePlayer),
|
|
1228
|
+
writableAccount(input.currencyCache),
|
|
1229
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
1230
|
+
retiredXpAccrualAccount(programAddress),
|
|
1231
|
+
], getPlaceCraftingHabBuildingsInstructionDataEncoder().encode({
|
|
1232
|
+
keyIndex: input.authorization.keyIndex,
|
|
1233
|
+
sequenceId: input.sequenceId,
|
|
1234
|
+
buildingChanges: input.buildingChanges.map(([id, amount]) => [
|
|
1235
|
+
id,
|
|
1236
|
+
amount,
|
|
1237
|
+
]),
|
|
1238
|
+
}));
|
|
1239
|
+
}
|
|
1240
|
+
/** Adapts finalizing a Crafting Hab's building design. No crew binding is
|
|
1241
|
+
* passed, so the game applies no crew upkeep discount. */
|
|
1242
|
+
export function adaptFinalizeCraftingHabBuildingChangesInstruction(programs, input, config = {}) {
|
|
1243
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1244
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1245
|
+
readonlyAccount(input.game),
|
|
1246
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1247
|
+
writableAccount(input.character),
|
|
1248
|
+
writableAccount(input.craftingHab),
|
|
1249
|
+
readonlyAccount(input.system),
|
|
1250
|
+
writableAccount(input.starbasePlayer),
|
|
1251
|
+
writableAccount(input.currencyCache),
|
|
1252
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
1253
|
+
readonlyAccount(programAddress),
|
|
1254
|
+
optionalWritableAccount(input.xpBudget, programAddress),
|
|
1255
|
+
optionalReadonlyAccount(input.xpBudgetConfig, programAddress),
|
|
1256
|
+
retiredXpAccrualAccount(programAddress),
|
|
1257
|
+
], getFinalizeHabBuildingChangesInstructionDataEncoder().encode({
|
|
1258
|
+
keyIndex: input.authorization.keyIndex,
|
|
1259
|
+
}));
|
|
1260
|
+
}
|
|
1261
|
+
/** Adapts cancelling a Crafting Hab's pending building design. */
|
|
1262
|
+
export function adaptCancelCraftingHabBuildingChangesInstruction(programs, input, config = {}) {
|
|
1263
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1264
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1265
|
+
readonlyAccount(input.game),
|
|
1266
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1267
|
+
writableAccount(input.craftingHab),
|
|
1268
|
+
readonlyAccount(input.system),
|
|
1269
|
+
writableAccount(input.starbasePlayer),
|
|
1270
|
+
writableAccount(input.currencyCache),
|
|
1271
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
1272
|
+
retiredXpAccrualAccount(programAddress),
|
|
1273
|
+
], getCancelHabBuildingDesignInstructionDataEncoder().encode({
|
|
1274
|
+
keyIndex: input.authorization.keyIndex,
|
|
1275
|
+
}));
|
|
1276
|
+
}
|
|
1277
|
+
/** Adapts a Starbase upgrade contribution with address-only Profile and
|
|
1278
|
+
* new-process signers. No crew binding is passed, so the program applies the
|
|
1279
|
+
* contributed crew without a roster bonus. */
|
|
1280
|
+
export function adaptContributeToStarbaseUpgradeInstruction(programs, input, config = {}) {
|
|
1281
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1282
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1283
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1284
|
+
writableAccount(input.character),
|
|
1285
|
+
readonlyAccount(input.system),
|
|
1286
|
+
writableAccount(input.starbasePlayer),
|
|
1287
|
+
writableSignerAddress(input.upgradeProcess),
|
|
1288
|
+
readonlyAccount(input.game),
|
|
1289
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
1290
|
+
readonlyAccount(programAddress),
|
|
1291
|
+
], getContributeToStarbaseUpgradeInstructionDataEncoder().encode({
|
|
1292
|
+
keyIndex: input.authorization.keyIndex,
|
|
1293
|
+
resourceId: input.cargoId,
|
|
1294
|
+
quantity: input.quantity,
|
|
1295
|
+
crew: input.crew,
|
|
1296
|
+
}));
|
|
1297
|
+
}
|
|
1298
|
+
/** Adapts the cancellation of a running Starbase upgrade contribution with
|
|
1299
|
+
* address-only Profile authorization. */
|
|
1300
|
+
export function adaptCancelStarbaseUpgradeContributionInstruction(programs, input, config = {}) {
|
|
1301
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1302
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1303
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1304
|
+
readonlyAccount(input.system),
|
|
1305
|
+
writableAccount(input.starbasePlayer),
|
|
1306
|
+
writableAccount(input.upgradeProcess),
|
|
1307
|
+
readonlyAccount(input.game),
|
|
1308
|
+
], getCancelStarbaseUpgradeContributionInstructionDataEncoder().encode({
|
|
1309
|
+
keyIndex: input.authorization.keyIndex,
|
|
1310
|
+
}));
|
|
1311
|
+
}
|
|
1312
|
+
/** Adapts the installation of a finished Starbase upgrade contribution with
|
|
1313
|
+
* address-only Profile authorization while rent is Disabled: the Plan passes
|
|
1314
|
+
* the Game's absent rent catalog and the System's absent level history head,
|
|
1315
|
+
* and omits the history pages only an existing head needs. */
|
|
1316
|
+
export function adaptInstallStarbaseUpgradeResourceInstruction(programs, input, config = {}) {
|
|
1317
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1318
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1319
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1320
|
+
writableAccount(input.system),
|
|
1321
|
+
writableAccount(input.starbasePlayer),
|
|
1322
|
+
writableAccount(input.upgradeProcess),
|
|
1323
|
+
writableAccount(input.regionTracker),
|
|
1324
|
+
readonlyAccount(input.game),
|
|
1325
|
+
readonlyAccount(input.rewardRegistry),
|
|
1326
|
+
readonlyAccount(input.rewardConfig),
|
|
1327
|
+
optionalWritableAccount(input.loyaltyEpoch, programAddress),
|
|
1328
|
+
optionalWritableAccount(input.loyaltyContribution, programAddress),
|
|
1329
|
+
writableAccount(input.kingTracker),
|
|
1330
|
+
readonlyAccount(input.rentCatalog),
|
|
1331
|
+
writableAccount(input.rentHead),
|
|
1332
|
+
// Level history pages exist only with the System's rent head.
|
|
1333
|
+
readonlyAccount(programAddress),
|
|
1334
|
+
readonlyAccount(programAddress),
|
|
1335
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
1336
|
+
writableAccount(input.democracyHistoryHistory),
|
|
1337
|
+
optionalReadonlyAccount(input.democracyHistoryPolicy, programAddress),
|
|
1338
|
+
optionalWritableAccount(input.democracyHistoryGeneration, programAddress),
|
|
1339
|
+
readonlyAccount(input.democracyHistoryInstallation),
|
|
1340
|
+
readonlyAccount(input.factionOwnership),
|
|
1341
|
+
], getInstallStarbaseUpgradeResourceInstructionDataEncoder().encode({
|
|
1342
|
+
keyIndex: input.authorization.keyIndex,
|
|
1343
|
+
}));
|
|
1344
|
+
}
|
|
1345
|
+
/** Adapts the permissionless opening of one faction's Loyalty epoch, its rent
|
|
1346
|
+
* paid by a wallet funder. */
|
|
1347
|
+
export function adaptInitLoyaltyEpochInstruction(programs, input, config = {}) {
|
|
1348
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1349
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1350
|
+
writableSignerAddress(input.funder),
|
|
1351
|
+
readonlyAccount(input.game),
|
|
1352
|
+
readonlyAccount(input.rewardRegistry),
|
|
1353
|
+
readonlyAccount(input.rewardConfig),
|
|
1354
|
+
writableAccount(input.loyaltyEpoch),
|
|
1355
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
1356
|
+
], getInitLoyaltyEpochInstructionDataEncoder().encode({
|
|
1357
|
+
factionId: input.factionId,
|
|
1358
|
+
epochIndex: input.epochIndex,
|
|
1359
|
+
}));
|
|
1360
|
+
}
|
|
1361
|
+
/** Adapts the permissionless opening of a Profile's Loyalty contribution for
|
|
1362
|
+
* one faction epoch, its rent paid by a wallet funder. */
|
|
1363
|
+
export function adaptInitLoyaltyContributionInstruction(programs, input, config = {}) {
|
|
1364
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1365
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1366
|
+
writableSignerAddress(input.funder),
|
|
1367
|
+
readonlyAccount(input.game),
|
|
1368
|
+
readonlyAccount(input.profile),
|
|
1369
|
+
readonlyAccount(input.loyaltyEpoch),
|
|
1370
|
+
writableAccount(input.loyaltyContribution),
|
|
1371
|
+
readonlyAccount(SYSTEM_PROGRAM),
|
|
1372
|
+
], getInitLoyaltyContributionInstructionDataEncoder().encode({
|
|
1373
|
+
factionId: input.factionId,
|
|
1374
|
+
epochIndex: input.epochIndex,
|
|
1375
|
+
}));
|
|
1376
|
+
}
|
|
1377
|
+
/** Adapts one Starbase repair by an Idle Fleet with address-only Profile
|
|
1378
|
+
* authorization. The Loyalty epoch and contribution are passed only when the
|
|
1379
|
+
* repair can earn Loyalty Points; `maxRepairKits` caps the kits it uses. */
|
|
1380
|
+
export function adaptRepairStarbaseInstruction(programs, input, config = {}) {
|
|
1381
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1382
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1383
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1384
|
+
writableAccount(input.fleet),
|
|
1385
|
+
writableAccount(input.system),
|
|
1386
|
+
readonlyAccount(input.game),
|
|
1387
|
+
readonlyAccount(input.rewardRegistry),
|
|
1388
|
+
readonlyAccount(input.rewardConfig),
|
|
1389
|
+
optionalWritableAccount(input.loyaltyEpoch, programAddress),
|
|
1390
|
+
optionalWritableAccount(input.loyaltyContribution, programAddress),
|
|
1391
|
+
], getRepairStarbaseInstructionDataEncoder().encode({
|
|
1392
|
+
keyIndex: input.authorization.keyIndex,
|
|
1393
|
+
amount: input.maxRepairKits ?? null,
|
|
1394
|
+
}));
|
|
1395
|
+
}
|
|
1396
|
+
/** Adapts one Fleet AP reload with address-only Profile authorization. */
|
|
1397
|
+
export function adaptReloadFleetApInstruction(programs, input, config = {}) {
|
|
1398
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1399
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1400
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1401
|
+
writableAccount(input.fleet),
|
|
1402
|
+
readonlyAccount(input.game),
|
|
1403
|
+
], getReloadFleetApInstructionDataEncoder().encode({
|
|
1404
|
+
keyIndex: input.authorization.keyIndex,
|
|
1405
|
+
}));
|
|
1406
|
+
}
|
|
1407
|
+
function fleetRepairRewardAccounts(input, programAddress) {
|
|
1408
|
+
return [
|
|
1409
|
+
readonlyAccount(input.rewardRegistry),
|
|
1410
|
+
readonlyAccount(input.rewardConfig),
|
|
1411
|
+
optionalWritableAccount(input.loyaltyEpoch, programAddress),
|
|
1412
|
+
optionalWritableAccount(input.loyaltyContribution, programAddress),
|
|
1413
|
+
];
|
|
1414
|
+
}
|
|
1415
|
+
/** Adapts one Idle Fleet repair with address-only Profile authorization: the
|
|
1416
|
+
* Fleet repairs itself, or `targetFleet` when given. `maxRepairKits` caps the
|
|
1417
|
+
* kits it uses. */
|
|
1418
|
+
export function adaptRepairIdleFleetInstruction(programs, input, config = {}) {
|
|
1419
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1420
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1421
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1422
|
+
writableAccount(input.fleet),
|
|
1423
|
+
optionalWritableAccount(input.targetFleet, programAddress),
|
|
1424
|
+
readonlyAccount(input.game),
|
|
1425
|
+
...fleetRepairRewardAccounts(input, programAddress),
|
|
1426
|
+
], getRepairIdleFleetInstructionDataEncoder().encode({
|
|
1427
|
+
keyIndex: input.authorization.keyIndex,
|
|
1428
|
+
amount: input.maxRepairKits ?? null,
|
|
1429
|
+
}));
|
|
1430
|
+
}
|
|
1431
|
+
/** Adapts one Docked Fleet repair at its Starbase with address-only Profile
|
|
1432
|
+
* authorization. The kits come from the owner's Starbase Player inventory. */
|
|
1433
|
+
export function adaptRepairDockedFleetInstruction(programs, input, config = {}) {
|
|
1434
|
+
const programAddress = getProgramAddress(programs, config);
|
|
1435
|
+
return createAddressOnlyInstruction(programAddress, [
|
|
1436
|
+
...authorizationAccounts(programs, input, programAddress),
|
|
1437
|
+
writableAccount(input.fleet),
|
|
1438
|
+
readonlyAccount(input.system),
|
|
1439
|
+
writableAccount(input.starbasePlayer),
|
|
1440
|
+
readonlyAccount(input.game),
|
|
1441
|
+
...fleetRepairRewardAccounts(input, programAddress),
|
|
1442
|
+
], getRepairDockedFleetInstructionDataEncoder().encode({
|
|
1443
|
+
keyIndex: input.authorization.keyIndex,
|
|
1444
|
+
amount: input.maxRepairKits ?? null,
|
|
1445
|
+
}));
|
|
1446
|
+
}
|
|
870
1447
|
//# sourceMappingURL=authorization-adapter.js.map
|