@aephia/atlas-kit 0.6.0-next.8 → 0.6.0-next.80
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 +3 -1
- package/dist/cargo/actions/deposit.d.ts +1 -1
- package/dist/cargo/actions/deposit.d.ts.map +1 -1
- package/dist/cargo/actions/deposit.js +25 -12
- package/dist/cargo/actions/deposit.js.map +1 -1
- package/dist/cargo/actions/index.d.ts.map +1 -1
- package/dist/cargo/actions/index.js +3 -2
- package/dist/cargo/actions/index.js.map +1 -1
- package/dist/cargo/actions/wallet-token.d.ts +1 -1
- package/dist/cargo/actions/wallet-token.d.ts.map +1 -1
- package/dist/cargo/actions/wallet-token.js +1 -9
- package/dist/cargo/actions/wallet-token.js.map +1 -1
- package/dist/cargo/actions/withdrawal.d.ts.map +1 -1
- package/dist/cargo/actions/withdrawal.js +22 -10
- package/dist/cargo/actions/withdrawal.js.map +1 -1
- package/dist/claim-stakes/actions/index.d.ts +13 -0
- package/dist/claim-stakes/actions/index.d.ts.map +1 -1
- package/dist/claim-stakes/actions/index.js +95 -44
- package/dist/claim-stakes/actions/index.js.map +1 -1
- package/dist/claim-stakes/index.d.ts +14 -0
- package/dist/claim-stakes/index.d.ts.map +1 -1
- package/dist/claim-stakes/index.js +23 -2
- package/dist/claim-stakes/index.js.map +1 -1
- package/dist/client/context.d.ts.map +1 -1
- package/dist/client/context.js +1 -1
- package/dist/client/context.js.map +1 -1
- package/dist/client/contracts.d.ts +16 -6
- package/dist/client/contracts.d.ts.map +1 -1
- package/dist/client/errors.d.ts +6 -2
- package/dist/client/errors.d.ts.map +1 -1
- package/dist/client/errors.js +31 -1
- package/dist/client/errors.js.map +1 -1
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/rpc-subscription-provider.d.ts +35 -0
- package/dist/client/rpc-subscription-provider.d.ts.map +1 -0
- package/dist/client/rpc-subscription-provider.js +190 -0
- package/dist/client/rpc-subscription-provider.js.map +1 -0
- package/dist/combat/actions/index.d.ts.map +1 -1
- package/dist/combat/actions/index.js +98 -50
- package/dist/combat/actions/index.js.map +1 -1
- package/dist/crafting/actions/index.d.ts +11 -0
- package/dist/crafting/actions/index.d.ts.map +1 -1
- package/dist/crafting/actions/index.js +60 -29
- package/dist/crafting/actions/index.js.map +1 -1
- package/dist/crafting/index.d.ts +31 -2
- package/dist/crafting/index.d.ts.map +1 -1
- package/dist/crafting/index.js +41 -14
- package/dist/crafting/index.js.map +1 -1
- package/dist/factions/actions/index.d.ts +1 -0
- package/dist/factions/actions/index.d.ts.map +1 -1
- package/dist/factions/actions/index.js.map +1 -1
- package/dist/factions/index.d.ts +1 -1
- package/dist/factions/index.d.ts.map +1 -1
- package/dist/factions/index.js +14 -8
- package/dist/factions/index.js.map +1 -1
- package/dist/factions/profile-faction.d.ts +20 -8
- package/dist/factions/profile-faction.d.ts.map +1 -1
- package/dist/factions/profile-faction.js +20 -8
- package/dist/factions/profile-faction.js.map +1 -1
- package/dist/fleets/actions/add-ship.d.ts +35 -0
- package/dist/fleets/actions/add-ship.d.ts.map +1 -0
- package/dist/fleets/actions/add-ship.js +149 -0
- package/dist/fleets/actions/add-ship.js.map +1 -0
- package/dist/fleets/actions/create-fleet.d.ts +36 -0
- package/dist/fleets/actions/create-fleet.d.ts.map +1 -0
- package/dist/fleets/actions/create-fleet.js +138 -0
- package/dist/fleets/actions/create-fleet.js.map +1 -0
- package/dist/fleets/actions/crew-transfer.d.ts +41 -0
- package/dist/fleets/actions/crew-transfer.d.ts.map +1 -0
- package/dist/fleets/actions/crew-transfer.js +114 -0
- package/dist/fleets/actions/crew-transfer.js.map +1 -0
- package/dist/fleets/actions/index.d.ts +33 -15
- package/dist/fleets/actions/index.d.ts.map +1 -1
- package/dist/fleets/actions/index.js +168 -110
- package/dist/fleets/actions/index.js.map +1 -1
- package/dist/fleets/actions/respawn.d.ts +38 -0
- package/dist/fleets/actions/respawn.d.ts.map +1 -0
- package/dist/fleets/actions/respawn.js +122 -0
- package/dist/fleets/actions/respawn.js.map +1 -0
- package/dist/fleets/actions/ship-import.d.ts.map +1 -1
- package/dist/fleets/actions/ship-import.js +37 -11
- package/dist/fleets/actions/ship-import.js.map +1 -1
- package/dist/fleets/cooldown.d.ts +44 -0
- package/dist/fleets/cooldown.d.ts.map +1 -0
- package/dist/fleets/cooldown.js +43 -0
- package/dist/fleets/cooldown.js.map +1 -0
- package/dist/fleets/coordinate-warp-estimate.d.ts +70 -0
- package/dist/fleets/coordinate-warp-estimate.d.ts.map +1 -0
- package/dist/fleets/coordinate-warp-estimate.js +46 -0
- package/dist/fleets/coordinate-warp-estimate.js.map +1 -0
- package/dist/fleets/index.d.ts +34 -0
- package/dist/fleets/index.d.ts.map +1 -1
- package/dist/fleets/index.js +51 -2
- package/dist/fleets/index.js.map +1 -1
- package/dist/fleets/movement-arithmetic.d.ts +21 -0
- package/dist/fleets/movement-arithmetic.d.ts.map +1 -0
- package/dist/fleets/movement-arithmetic.js +41 -0
- package/dist/fleets/movement-arithmetic.js.map +1 -0
- package/dist/fleets/subwarp-estimate.d.ts +70 -0
- package/dist/fleets/subwarp-estimate.d.ts.map +1 -0
- package/dist/fleets/subwarp-estimate.js +38 -0
- package/dist/fleets/subwarp-estimate.js.map +1 -0
- package/dist/fleets/warp-lane-estimate.d.ts +59 -0
- package/dist/fleets/warp-lane-estimate.d.ts.map +1 -0
- package/dist/fleets/warp-lane-estimate.js +36 -0
- package/dist/fleets/warp-lane-estimate.js.map +1 -0
- package/dist/fleets/warp-lane-policy.d.ts +68 -0
- package/dist/fleets/warp-lane-policy.d.ts.map +1 -0
- package/dist/fleets/warp-lane-policy.js +91 -0
- package/dist/fleets/warp-lane-policy.js.map +1 -0
- package/dist/fleets/warp-lane-toll.d.ts +55 -0
- package/dist/fleets/warp-lane-toll.d.ts.map +1 -0
- package/dist/fleets/warp-lane-toll.js +79 -0
- package/dist/fleets/warp-lane-toll.js.map +1 -0
- package/dist/identity/actions/create-profile.d.ts +56 -0
- package/dist/identity/actions/create-profile.d.ts.map +1 -0
- package/dist/identity/actions/create-profile.js +139 -0
- package/dist/identity/actions/create-profile.js.map +1 -0
- package/dist/identity/actions/index.d.ts +4 -3
- package/dist/identity/actions/index.d.ts.map +1 -1
- package/dist/identity/actions/index.js +49 -27
- package/dist/identity/actions/index.js.map +1 -1
- package/dist/identity/index.d.ts +15 -0
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/identity/index.js +15 -0
- package/dist/identity/index.js.map +1 -1
- package/dist/identity/permissions.d.ts +124 -0
- package/dist/identity/permissions.d.ts.map +1 -0
- package/dist/identity/permissions.js +171 -0
- package/dist/identity/permissions.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/c4/cargo-bytes-config.d.ts +7 -0
- package/dist/internal/c4/cargo-bytes-config.d.ts.map +1 -0
- package/dist/internal/c4/cargo-bytes-config.js +19 -0
- package/dist/internal/c4/cargo-bytes-config.js.map +1 -0
- package/dist/internal/c4/character-registration.d.ts +2 -0
- package/dist/internal/c4/character-registration.d.ts.map +1 -1
- package/dist/internal/c4/character-registration.js +2 -0
- package/dist/internal/c4/character-registration.js.map +1 -1
- package/dist/internal/c4/claim-stake.d.ts +4 -27
- package/dist/internal/c4/claim-stake.d.ts.map +1 -1
- package/dist/internal/c4/claim-stake.js +25 -38
- package/dist/internal/c4/claim-stake.js.map +1 -1
- package/dist/internal/c4/combat.d.ts +0 -27
- package/dist/internal/c4/combat.d.ts.map +1 -1
- package/dist/internal/c4/combat.js +0 -33
- package/dist/internal/c4/combat.js.map +1 -1
- package/dist/internal/c4/crafting-process-codec.d.ts +13 -0
- package/dist/internal/c4/crafting-process-codec.d.ts.map +1 -0
- package/dist/internal/c4/crafting-process-codec.js +34 -0
- package/dist/internal/c4/crafting-process-codec.js.map +1 -0
- package/dist/internal/c4/crafting.d.ts +11 -31
- package/dist/internal/c4/crafting.d.ts.map +1 -1
- package/dist/internal/c4/crafting.js +26 -43
- package/dist/internal/c4/crafting.js.map +1 -1
- package/dist/internal/c4/faction-adapter.d.ts +12 -0
- package/dist/internal/c4/faction-adapter.d.ts.map +1 -0
- package/dist/internal/c4/faction-adapter.js +52 -0
- package/dist/internal/c4/faction-adapter.js.map +1 -0
- package/dist/internal/c4/faction-epoch-meter.d.ts +10 -0
- package/dist/internal/c4/faction-epoch-meter.d.ts.map +1 -0
- package/dist/internal/c4/faction-epoch-meter.js +31 -0
- package/dist/internal/c4/faction-epoch-meter.js.map +1 -0
- package/dist/internal/c4/faction-treasury.d.ts +23 -0
- package/dist/internal/c4/faction-treasury.d.ts.map +1 -0
- package/dist/internal/c4/faction-treasury.js +48 -0
- package/dist/internal/c4/faction-treasury.js.map +1 -0
- package/dist/internal/c4/factions.d.ts +9 -57
- package/dist/internal/c4/factions.d.ts.map +1 -1
- package/dist/internal/c4/factions.js +21 -139
- package/dist/internal/c4/factions.js.map +1 -1
- package/dist/internal/c4/fleet-arrival.d.ts +28 -0
- package/dist/internal/c4/fleet-arrival.d.ts.map +1 -0
- package/dist/internal/c4/fleet-arrival.js +42 -0
- package/dist/internal/c4/fleet-arrival.js.map +1 -0
- package/dist/internal/c4/fleet-creation.d.ts +7 -0
- package/dist/internal/c4/fleet-creation.d.ts.map +1 -0
- package/dist/internal/c4/fleet-creation.js +180 -0
- package/dist/internal/c4/fleet-creation.js.map +1 -0
- package/dist/internal/c4/fleet-crew-binding.d.ts +9 -0
- package/dist/internal/c4/fleet-crew-binding.d.ts.map +1 -1
- package/dist/internal/c4/fleet-crew-binding.js +15 -0
- package/dist/internal/c4/fleet-crew-binding.js.map +1 -1
- package/dist/internal/c4/fleet-respawn.d.ts +19 -0
- package/dist/internal/c4/fleet-respawn.d.ts.map +1 -0
- package/dist/internal/c4/fleet-respawn.js +91 -0
- package/dist/internal/c4/fleet-respawn.js.map +1 -0
- package/dist/internal/c4/fleet-ship-assembly.d.ts +11 -0
- package/dist/internal/c4/fleet-ship-assembly.d.ts.map +1 -0
- package/dist/internal/c4/fleet-ship-assembly.js +44 -0
- package/dist/internal/c4/fleet-ship-assembly.js.map +1 -0
- package/dist/internal/c4/fleet.d.ts +45 -19
- package/dist/internal/c4/fleet.d.ts.map +1 -1
- package/dist/internal/c4/fleet.js +26 -7
- package/dist/internal/c4/fleet.js.map +1 -1
- package/dist/internal/c4/game.d.ts +27 -9
- package/dist/internal/c4/game.d.ts.map +1 -1
- package/dist/internal/c4/game.js +77 -14
- package/dist/internal/c4/game.js.map +1 -1
- package/dist/internal/c4/identity.d.ts +2 -7
- package/dist/internal/c4/identity.d.ts.map +1 -1
- package/dist/internal/c4/identity.js +2 -23
- package/dist/internal/c4/identity.js.map +1 -1
- package/dist/internal/c4/loyalty.d.ts +0 -27
- package/dist/internal/c4/loyalty.d.ts.map +1 -1
- package/dist/internal/c4/loyalty.js +0 -33
- package/dist/internal/c4/loyalty.js.map +1 -1
- package/dist/internal/c4/market.d.ts +2 -38
- package/dist/internal/c4/market.d.ts.map +1 -1
- package/dist/internal/c4/market.js +13 -51
- package/dist/internal/c4/market.js.map +1 -1
- package/dist/internal/c4/mining-instructions.d.ts +2 -0
- package/dist/internal/c4/mining-instructions.d.ts.map +1 -0
- package/dist/internal/c4/mining-instructions.js +3 -0
- package/dist/internal/c4/mining-instructions.js.map +1 -0
- package/dist/internal/c4/open-signal.d.ts +8 -0
- package/dist/internal/c4/open-signal.d.ts.map +1 -0
- package/dist/internal/c4/open-signal.js +37 -0
- package/dist/internal/c4/open-signal.js.map +1 -0
- package/dist/internal/c4/profile-creation.d.ts +17 -0
- package/dist/internal/c4/profile-creation.d.ts.map +1 -0
- package/dist/internal/c4/profile-creation.js +36 -0
- package/dist/internal/c4/profile-creation.js.map +1 -0
- package/dist/internal/c4/profile-permissions.d.ts +14 -0
- package/dist/internal/c4/profile-permissions.d.ts.map +1 -0
- package/dist/internal/c4/profile-permissions.js +81 -0
- package/dist/internal/c4/profile-permissions.js.map +1 -0
- package/dist/internal/c4/region-geometry.d.ts +8 -0
- package/dist/internal/c4/region-geometry.d.ts.map +1 -0
- package/dist/internal/c4/region-geometry.js +43 -0
- package/dist/internal/c4/region-geometry.js.map +1 -0
- package/dist/internal/c4/rewards.d.ts +0 -27
- package/dist/internal/c4/rewards.d.ts.map +1 -1
- package/dist/internal/c4/rewards.js +0 -33
- package/dist/internal/c4/rewards.js.map +1 -1
- package/dist/internal/c4/runtime-bindings.d.ts +3 -0
- package/dist/internal/c4/runtime-bindings.d.ts.map +1 -0
- package/dist/internal/c4/runtime-bindings.js +4 -0
- package/dist/internal/c4/runtime-bindings.js.map +1 -0
- package/dist/internal/c4/scan-detection-codecs.d.ts +3 -0
- package/dist/internal/c4/scan-detection-codecs.d.ts.map +1 -0
- package/dist/internal/c4/scan-detection-codecs.js +3 -0
- package/dist/internal/c4/scan-detection-codecs.js.map +1 -0
- package/dist/internal/c4/scan-lifecycle.d.ts +306 -0
- package/dist/internal/c4/scan-lifecycle.d.ts.map +1 -0
- package/dist/internal/c4/scan-lifecycle.js +258 -0
- package/dist/internal/c4/scan-lifecycle.js.map +1 -0
- package/dist/internal/c4/scanning.d.ts +1 -28
- package/dist/internal/c4/scanning.d.ts.map +1 -1
- package/dist/internal/c4/scanning.js +2 -33
- package/dist/internal/c4/scanning.js.map +1 -1
- package/dist/internal/c4/ship-import.d.ts +4 -0
- package/dist/internal/c4/ship-import.d.ts.map +1 -0
- package/dist/internal/c4/ship-import.js +13 -0
- package/dist/internal/c4/ship-import.js.map +1 -0
- package/dist/internal/c4/ship-stats.d.ts.map +1 -1
- package/dist/internal/c4/ship-stats.js +25 -21
- package/dist/internal/c4/ship-stats.js.map +1 -1
- package/dist/internal/c4/starbase.d.ts +0 -32
- package/dist/internal/c4/starbase.d.ts.map +1 -1
- package/dist/internal/c4/starbase.js +3 -41
- package/dist/internal/c4/starbase.js.map +1 -1
- package/dist/internal/c4/world.d.ts +36 -7
- package/dist/internal/c4/world.d.ts.map +1 -1
- package/dist/internal/c4/world.js +58 -25
- package/dist/internal/c4/world.js.map +1 -1
- package/dist/internal/cargo.d.ts +2 -0
- package/dist/internal/cargo.d.ts.map +1 -1
- package/dist/internal/cargo.js +8 -0
- package/dist/internal/cargo.js.map +1 -1
- package/dist/internal/fleet.d.ts +1 -0
- package/dist/internal/fleet.d.ts.map +1 -1
- package/dist/internal/fleet.js +3 -1
- package/dist/internal/fleet.js.map +1 -1
- package/dist/internal/loyalty-atlas-bank-state.d.ts +16 -0
- package/dist/internal/loyalty-atlas-bank-state.d.ts.map +1 -0
- package/dist/internal/loyalty-atlas-bank-state.js +10 -0
- package/dist/internal/loyalty-atlas-bank-state.js.map +1 -0
- package/dist/internal/planning/action-runtime.d.ts +38 -0
- package/dist/internal/planning/action-runtime.d.ts.map +1 -0
- package/dist/internal/planning/action-runtime.js +63 -0
- package/dist/internal/planning/action-runtime.js.map +1 -0
- package/dist/internal/planning/arrival-guards.d.ts +20 -0
- package/dist/internal/planning/arrival-guards.d.ts.map +1 -0
- package/dist/internal/planning/arrival-guards.js +187 -0
- package/dist/internal/planning/arrival-guards.js.map +1 -0
- package/dist/internal/planning/authorization-adapter.d.ts +6 -6
- package/dist/internal/planning/authorization-adapter.d.ts.map +1 -1
- package/dist/internal/planning/authorization-adapter.js +81 -16
- package/dist/internal/planning/authorization-adapter.js.map +1 -1
- package/dist/internal/planning/character-registration-guard.d.ts +4 -0
- package/dist/internal/planning/character-registration-guard.d.ts.map +1 -0
- package/dist/internal/planning/character-registration-guard.js +58 -0
- package/dist/internal/planning/character-registration-guard.js.map +1 -0
- package/dist/internal/planning/character-registration.d.ts +23 -0
- package/dist/internal/planning/character-registration.d.ts.map +1 -0
- package/dist/internal/planning/character-registration.js +86 -0
- package/dist/internal/planning/character-registration.js.map +1 -0
- package/dist/internal/planning/democracy-history.d.ts +50 -0
- package/dist/internal/planning/democracy-history.d.ts.map +1 -0
- package/dist/internal/planning/democracy-history.js +198 -0
- package/dist/internal/planning/democracy-history.js.map +1 -0
- package/dist/internal/planning/faction-trade-guards.d.ts +30 -0
- package/dist/internal/planning/faction-trade-guards.d.ts.map +1 -0
- package/dist/internal/planning/faction-trade-guards.js +15 -0
- package/dist/internal/planning/faction-trade-guards.js.map +1 -0
- package/dist/internal/planning/faction-trade-state.d.ts +16 -0
- package/dist/internal/planning/faction-trade-state.d.ts.map +1 -0
- package/dist/internal/planning/faction-trade-state.js +43 -0
- package/dist/internal/planning/faction-trade-state.js.map +1 -0
- package/dist/internal/planning/fleet-arrival.d.ts +40 -0
- package/dist/internal/planning/fleet-arrival.d.ts.map +1 -0
- package/dist/internal/planning/fleet-arrival.js +105 -0
- package/dist/internal/planning/fleet-arrival.js.map +1 -0
- package/dist/internal/planning/fleet-attack-xp.d.ts +20 -0
- package/dist/internal/planning/fleet-attack-xp.d.ts.map +1 -0
- package/dist/internal/planning/fleet-attack-xp.js +110 -0
- package/dist/internal/planning/fleet-attack-xp.js.map +1 -0
- package/dist/internal/planning/fleet-creation.d.ts +30 -0
- package/dist/internal/planning/fleet-creation.d.ts.map +1 -0
- package/dist/internal/planning/fleet-creation.js +107 -0
- package/dist/internal/planning/fleet-creation.js.map +1 -0
- package/dist/internal/planning/fleet-crew-guard.d.ts +28 -0
- package/dist/internal/planning/fleet-crew-guard.d.ts.map +1 -0
- package/dist/internal/planning/fleet-crew-guard.js +47 -0
- package/dist/internal/planning/fleet-crew-guard.js.map +1 -0
- package/dist/internal/planning/fleet-crew-transfer.d.ts +7 -0
- package/dist/internal/planning/fleet-crew-transfer.d.ts.map +1 -0
- package/dist/internal/planning/fleet-crew-transfer.js +131 -0
- package/dist/internal/planning/fleet-crew-transfer.js.map +1 -0
- package/dist/internal/planning/fleet-respawn.d.ts +28 -0
- package/dist/internal/planning/fleet-respawn.d.ts.map +1 -0
- package/dist/internal/planning/fleet-respawn.js +164 -0
- package/dist/internal/planning/fleet-respawn.js.map +1 -0
- package/dist/internal/planning/fleet-ship-assembly.d.ts +36 -0
- package/dist/internal/planning/fleet-ship-assembly.d.ts.map +1 -0
- package/dist/internal/planning/fleet-ship-assembly.js +136 -0
- package/dist/internal/planning/fleet-ship-assembly.js.map +1 -0
- package/dist/internal/planning/governance-fees.d.ts +64 -0
- package/dist/internal/planning/governance-fees.d.ts.map +1 -0
- package/dist/internal/planning/governance-fees.js +239 -0
- package/dist/internal/planning/governance-fees.js.map +1 -0
- package/dist/internal/planning/mining-stop.d.ts +14 -0
- package/dist/internal/planning/mining-stop.d.ts.map +1 -0
- package/dist/internal/planning/mining-stop.js +41 -0
- package/dist/internal/planning/mining-stop.js.map +1 -0
- package/dist/internal/planning/movement-character.d.ts +7 -0
- package/dist/internal/planning/movement-character.d.ts.map +1 -0
- package/dist/internal/planning/movement-character.js +41 -0
- package/dist/internal/planning/movement-character.js.map +1 -0
- package/dist/internal/planning/movement-xp-guard.d.ts +4 -0
- package/dist/internal/planning/movement-xp-guard.d.ts.map +1 -0
- package/dist/internal/planning/movement-xp-guard.js +103 -0
- package/dist/internal/planning/movement-xp-guard.js.map +1 -0
- package/dist/internal/planning/open-signal-guard.d.ts +3 -0
- package/dist/internal/planning/open-signal-guard.d.ts.map +1 -0
- package/dist/internal/planning/open-signal-guard.js +31 -0
- package/dist/internal/planning/open-signal-guard.js.map +1 -0
- package/dist/internal/planning/open-signal.d.ts +31 -0
- package/dist/internal/planning/open-signal.d.ts.map +1 -0
- package/dist/internal/planning/open-signal.js +84 -0
- package/dist/internal/planning/open-signal.js.map +1 -0
- package/dist/internal/planning/respawn-guards.d.ts +3 -0
- package/dist/internal/planning/respawn-guards.d.ts.map +1 -0
- package/dist/internal/planning/respawn-guards.js +41 -0
- package/dist/internal/planning/respawn-guards.js.map +1 -0
- package/dist/internal/planning/runtime-guards.d.ts +43 -0
- package/dist/internal/planning/runtime-guards.d.ts.map +1 -0
- package/dist/internal/planning/runtime-guards.js +636 -0
- package/dist/internal/planning/runtime-guards.js.map +1 -0
- package/dist/internal/planning/scan-completion-guard.d.ts +43 -0
- package/dist/internal/planning/scan-completion-guard.d.ts.map +1 -0
- package/dist/internal/planning/scan-completion-guard.js +94 -0
- package/dist/internal/planning/scan-completion-guard.js.map +1 -0
- package/dist/internal/planning/scan-completion.d.ts +20 -0
- package/dist/internal/planning/scan-completion.d.ts.map +1 -0
- package/dist/internal/planning/scan-completion.js +196 -0
- package/dist/internal/planning/scan-completion.js.map +1 -0
- package/dist/internal/planning/scan-detect-guard.d.ts +34 -0
- package/dist/internal/planning/scan-detect-guard.d.ts.map +1 -0
- package/dist/internal/planning/scan-detect-guard.js +77 -0
- package/dist/internal/planning/scan-detect-guard.js.map +1 -0
- package/dist/internal/planning/scan-detect.d.ts +24 -0
- package/dist/internal/planning/scan-detect.d.ts.map +1 -0
- package/dist/internal/planning/scan-detect.js +244 -0
- package/dist/internal/planning/scan-detect.js.map +1 -0
- package/dist/internal/planning/scan-input.d.ts +9 -0
- package/dist/internal/planning/scan-input.d.ts.map +1 -0
- package/dist/internal/planning/scan-input.js +58 -0
- package/dist/internal/planning/scan-input.js.map +1 -0
- package/dist/internal/planning/ship-import-funding.d.ts +22 -0
- package/dist/internal/planning/ship-import-funding.d.ts.map +1 -0
- package/dist/internal/planning/ship-import-funding.js +52 -0
- package/dist/internal/planning/ship-import-funding.js.map +1 -0
- package/dist/internal/planning/ship-token.d.ts.map +1 -1
- package/dist/internal/planning/ship-token.js +2 -4
- package/dist/internal/planning/ship-token.js.map +1 -1
- package/dist/internal/planning/starbase-system-guard.d.ts +6 -0
- package/dist/internal/planning/starbase-system-guard.d.ts.map +1 -0
- package/dist/internal/planning/starbase-system-guard.js +93 -0
- package/dist/internal/planning/starbase-system-guard.js.map +1 -0
- package/dist/internal/planning/starbase-system.d.ts +12 -0
- package/dist/internal/planning/starbase-system.d.ts.map +1 -0
- package/dist/internal/planning/starbase-system.js +22 -0
- package/dist/internal/planning/starbase-system.js.map +1 -0
- package/dist/internal/planning/token-mint.d.ts +4 -0
- package/dist/internal/planning/token-mint.d.ts.map +1 -0
- package/dist/internal/planning/token-mint.js +15 -0
- package/dist/internal/planning/token-mint.js.map +1 -0
- package/dist/internal/planning/trade-faction-market.d.ts +20 -0
- package/dist/internal/planning/trade-faction-market.d.ts.map +1 -0
- package/dist/internal/planning/trade-faction-market.js +56 -0
- package/dist/internal/planning/trade-faction-market.js.map +1 -0
- package/dist/internal/planning/xp-runtime.d.ts +36 -0
- package/dist/internal/planning/xp-runtime.d.ts.map +1 -0
- package/dist/internal/planning/xp-runtime.js +126 -0
- package/dist/internal/planning/xp-runtime.js.map +1 -0
- package/dist/loyalty/actions/index.d.ts.map +1 -1
- package/dist/loyalty/actions/index.js +4 -3
- package/dist/loyalty/actions/index.js.map +1 -1
- package/dist/loyalty/index.d.ts.map +1 -1
- package/dist/loyalty/index.js +2 -6
- package/dist/loyalty/index.js.map +1 -1
- package/dist/markets/actions/index.d.ts +4 -3
- package/dist/markets/actions/index.d.ts.map +1 -1
- package/dist/markets/actions/index.js +48 -24
- package/dist/markets/actions/index.js.map +1 -1
- package/dist/markets/actions/trade-faction-market.d.ts +43 -0
- package/dist/markets/actions/trade-faction-market.d.ts.map +1 -0
- package/dist/markets/actions/trade-faction-market.js +291 -0
- package/dist/markets/actions/trade-faction-market.js.map +1 -0
- package/dist/markets/index.d.ts +7 -7
- package/dist/markets/index.d.ts.map +1 -1
- package/dist/markets/index.js +9 -9
- package/dist/markets/index.js.map +1 -1
- package/dist/mining/actions/index.d.ts +84 -0
- package/dist/mining/actions/index.d.ts.map +1 -0
- package/dist/mining/actions/index.js +328 -0
- package/dist/mining/actions/index.js.map +1 -0
- package/dist/mining/estimate.d.ts +114 -0
- package/dist/mining/estimate.d.ts.map +1 -0
- package/dist/mining/estimate.js +127 -0
- package/dist/mining/estimate.js.map +1 -0
- package/dist/mining/index.d.ts +8 -2
- package/dist/mining/index.d.ts.map +1 -1
- package/dist/mining/index.js +6 -2
- package/dist/mining/index.js.map +1 -1
- package/dist/planning/assembly.d.ts.map +1 -1
- package/dist/planning/assembly.js +18 -0
- package/dist/planning/assembly.js.map +1 -1
- package/dist/planning/execution.d.ts.map +1 -1
- package/dist/planning/execution.js +382 -16
- package/dist/planning/execution.js.map +1 -1
- package/dist/planning/index.d.ts +170 -149
- package/dist/planning/index.d.ts.map +1 -1
- package/dist/planning/index.js +828 -121
- package/dist/planning/index.js.map +1 -1
- package/dist/planning/plan-sequence.d.ts.map +1 -1
- package/dist/planning/plan-sequence.js +8 -1
- package/dist/planning/plan-sequence.js.map +1 -1
- package/dist/planning/simulation.d.ts +25 -1
- package/dist/planning/simulation.d.ts.map +1 -1
- package/dist/planning/simulation.js +111 -11
- package/dist/planning/simulation.js.map +1 -1
- package/dist/registry/cargo.d.ts +6 -11
- package/dist/registry/cargo.d.ts.map +1 -1
- package/dist/registry/cargo.js +19 -19
- package/dist/registry/cargo.js.map +1 -1
- package/dist/registry/index.d.ts +4 -0
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/onboarding.d.ts +8 -1
- package/dist/registry/onboarding.d.ts.map +1 -1
- package/dist/registry/onboarding.js +18 -5
- package/dist/registry/onboarding.js.map +1 -1
- package/dist/registry/scanning.d.ts +7 -0
- package/dist/registry/scanning.d.ts.map +1 -0
- package/dist/registry/scanning.js +13 -0
- package/dist/registry/scanning.js.map +1 -0
- package/dist/registry/ship-stats-snapshot.js +19 -19
- package/dist/registry/ship-stats-snapshot.js.map +1 -1
- package/dist/registry/ships.d.ts +22 -2
- package/dist/registry/ships.d.ts.map +1 -1
- package/dist/registry/ships.js +28 -4
- package/dist/registry/ships.js.map +1 -1
- package/dist/registry/xp-runtime.d.ts +4 -0
- package/dist/registry/xp-runtime.d.ts.map +1 -0
- package/dist/registry/xp-runtime.js +14 -0
- package/dist/registry/xp-runtime.js.map +1 -0
- package/dist/scanning/actions/index.d.ts +116 -0
- package/dist/scanning/actions/index.d.ts.map +1 -0
- package/dist/scanning/actions/index.js +185 -0
- package/dist/scanning/actions/index.js.map +1 -0
- package/dist/scanning/index.d.ts +4 -1
- package/dist/scanning/index.d.ts.map +1 -1
- package/dist/scanning/index.js +12 -8
- package/dist/scanning/index.js.map +1 -1
- package/dist/scanning/lifecycle.d.ts +77 -0
- package/dist/scanning/lifecycle.d.ts.map +1 -0
- package/dist/scanning/lifecycle.js +93 -0
- package/dist/scanning/lifecycle.js.map +1 -0
- package/dist/scanning/odds.d.ts +111 -0
- package/dist/scanning/odds.d.ts.map +1 -0
- package/dist/scanning/odds.js +294 -0
- package/dist/scanning/odds.js.map +1 -0
- package/dist/scanning/signals.d.ts +121 -0
- package/dist/scanning/signals.d.ts.map +1 -0
- package/dist/scanning/signals.js +171 -0
- package/dist/scanning/signals.js.map +1 -0
- package/dist/world/index.d.ts +110 -5
- package/dist/world/index.d.ts.map +1 -1
- package/dist/world/index.js +109 -4
- package/dist/world/index.js.map +1 -1
- package/dist/world/planet-claim-stake-plots.d.ts +130 -0
- package/dist/world/planet-claim-stake-plots.d.ts.map +1 -0
- package/dist/world/planet-claim-stake-plots.js +110 -0
- package/dist/world/planet-claim-stake-plots.js.map +1 -0
- package/dist/world/starbase-status.d.ts +176 -0
- package/dist/world/starbase-status.d.ts.map +1 -0
- package/dist/world/starbase-status.js +153 -0
- package/dist/world/starbase-status.js.map +1 -0
- package/package.json +10 -2
package/dist/planning/index.js
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
|
+
import { validateCrewTransferInstructions, } from '../internal/planning/fleet-crew-guard.js';
|
|
2
|
+
import { validateCompletionInstructions, scanCompletionDiscriminators, } from '../internal/planning/scan-completion-guard.js';
|
|
3
|
+
import { validateOpenSignalInstructions } from '../internal/planning/open-signal-guard.js';
|
|
4
|
+
import { validateDetectInstructions, } from '../internal/planning/scan-detect-guard.js';
|
|
5
|
+
import { validateRespawnInstructions } from '../internal/planning/respawn-guards.js';
|
|
6
|
+
import { validateFleetAttackInstructions, } from '../internal/planning/fleet-attack-xp.js';
|
|
7
|
+
import { validateMovementXpInstructions } from '../internal/planning/movement-xp-guard.js';
|
|
8
|
+
import { validateStarbaseSystemInstructions, validateStarbaseSystemGuards, } from '../internal/planning/starbase-system-guard.js';
|
|
9
|
+
import { validateCharacterRegistrationInstructions } from '../internal/planning/character-registration-guard.js';
|
|
10
|
+
import { normalizeArrivalGuard, arrivalGuardToJSON, validateArrivalInstructions, } from '../internal/planning/arrival-guards.js';
|
|
11
|
+
import { isRuntimeGuard, normalizeRuntimeGuard, runtimeGuardToJSON, validateRuntimeInstructions, } from '../internal/planning/runtime-guards.js';
|
|
12
|
+
import { isTradeBuyGuard, isTradeSellGuard, isTradeMeterGuard, isFactionTradeGuard, } from '../internal/planning/faction-trade-guards.js';
|
|
1
13
|
import { AccountRole, getBase64Decoder, getBase64Encoder, isAddress, isWritableRole, } from '@solana/kit';
|
|
2
|
-
import { InvalidActionInputError } from '../client/errors.js';
|
|
14
|
+
import { InvalidActionInputError, SageSdkError } from '../client/errors.js';
|
|
3
15
|
import { deepFreeze } from '../internal/immutable-tree.js';
|
|
16
|
+
import { validateMiningStopInstructions } from '../internal/planning/mining-stop.js';
|
|
4
17
|
import { validatePlanComposition } from './composition.js';
|
|
5
18
|
import { isPlanInstance, registerPlanInstance } from './plan-instances.js';
|
|
6
|
-
const PLAN_BRAND = Symbol('AephiaSagePlan');
|
|
7
19
|
const BASE64_PATTERN = /^(?:[A-Za-z\d+/]{4})*(?:[A-Za-z\d+/]{2}==|[A-Za-z\d+/]{3}=)?$/u;
|
|
8
20
|
const DATA_HASH_PATTERN = /^[\da-f]{64}$/u;
|
|
9
21
|
const ACCOUNT_ROLES = new Set([
|
|
@@ -138,7 +150,7 @@ function normalizeSemanticFact(value, field) {
|
|
|
138
150
|
if (semantic.scope !== 'transaction') {
|
|
139
151
|
return invalid(`${field}.scope`, semantic.scope, 'the token "transaction"');
|
|
140
152
|
}
|
|
141
|
-
return { kind: 'exclusive', scope: 'transaction' };
|
|
153
|
+
return Object.freeze({ kind: 'exclusive', scope: 'transaction' });
|
|
142
154
|
}
|
|
143
155
|
if (semantic.kind === 'requires' || semantic.kind === 'invalidates') {
|
|
144
156
|
assertKeys(semantic, field, ['kind', 'resource', 'fact']);
|
|
@@ -159,9 +171,582 @@ function normalizeSemanticFact(value, field) {
|
|
|
159
171
|
}
|
|
160
172
|
return invalid(`${field}.kind`, semantic.kind, 'one of exclusive, requires, invalidates, or transition');
|
|
161
173
|
}
|
|
162
|
-
function normalizePrecondition(value, field
|
|
174
|
+
function normalizePrecondition(value, field) {
|
|
163
175
|
const precondition = readRecord(value, field);
|
|
164
|
-
if (
|
|
176
|
+
if (precondition.kind === 'fleet-arrival')
|
|
177
|
+
return normalizeArrivalGuard(precondition, field);
|
|
178
|
+
if (isRuntimeGuard(precondition))
|
|
179
|
+
return normalizeRuntimeGuard(precondition, field);
|
|
180
|
+
if (precondition.kind === 'character-registration') {
|
|
181
|
+
assertKeys(precondition, field, [
|
|
182
|
+
'kind',
|
|
183
|
+
'address',
|
|
184
|
+
'game',
|
|
185
|
+
'profile',
|
|
186
|
+
'profileDataHash',
|
|
187
|
+
'funder',
|
|
188
|
+
'xpBudget',
|
|
189
|
+
'xpBudgetConfig',
|
|
190
|
+
'maximumFunderDebit',
|
|
191
|
+
'characterSize',
|
|
192
|
+
'initializationHash',
|
|
193
|
+
'characterLamports',
|
|
194
|
+
'budgetLamports',
|
|
195
|
+
'describes',
|
|
196
|
+
]);
|
|
197
|
+
if (typeof precondition.characterSize !== 'number' ||
|
|
198
|
+
!Number.isSafeInteger(precondition.characterSize) ||
|
|
199
|
+
precondition.characterSize < 423)
|
|
200
|
+
invalid(`${field}.characterSize`, precondition.characterSize, 'a qualified Character allocation of at least 423 bytes');
|
|
201
|
+
for (const key of ['characterLamports', 'budgetLamports'])
|
|
202
|
+
if (typeof precondition[key] !== 'bigint' || precondition[key] < 0n)
|
|
203
|
+
invalid(`${field}.${key}`, precondition[key], 'a nonnegative bigint');
|
|
204
|
+
const maximumFunderDebit = precondition.maximumFunderDebit;
|
|
205
|
+
if (typeof maximumFunderDebit !== 'bigint' || maximumFunderDebit < 0n)
|
|
206
|
+
invalid(`${field}.maximumFunderDebit`, maximumFunderDebit, 'a nonnegative bigint');
|
|
207
|
+
return Object.freeze({
|
|
208
|
+
kind: 'character-registration',
|
|
209
|
+
address: readAddress(precondition.address, `${field}.address`),
|
|
210
|
+
game: readAddress(precondition.game, `${field}.game`),
|
|
211
|
+
profile: readAddress(precondition.profile, `${field}.profile`),
|
|
212
|
+
profileDataHash: readDataHash(precondition.profileDataHash, `${field}.profileDataHash`),
|
|
213
|
+
funder: readAddress(precondition.funder, `${field}.funder`),
|
|
214
|
+
xpBudget: readAddress(precondition.xpBudget, `${field}.xpBudget`),
|
|
215
|
+
xpBudgetConfig: readAddress(precondition.xpBudgetConfig, `${field}.xpBudgetConfig`),
|
|
216
|
+
maximumFunderDebit,
|
|
217
|
+
characterLamports: precondition.characterLamports,
|
|
218
|
+
budgetLamports: precondition.budgetLamports,
|
|
219
|
+
characterSize: precondition.characterSize,
|
|
220
|
+
initializationHash: readDataHash(precondition.initializationHash, `${field}.initializationHash`),
|
|
221
|
+
describes: readString(precondition.describes, `${field}.describes`),
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
if (precondition.kind === 'ship-import-funding') {
|
|
225
|
+
assertKeys(precondition, field, [
|
|
226
|
+
'kind',
|
|
227
|
+
'address',
|
|
228
|
+
'game',
|
|
229
|
+
'profile',
|
|
230
|
+
'system',
|
|
231
|
+
'shipId',
|
|
232
|
+
'maximumProfileDebit',
|
|
233
|
+
'describes',
|
|
234
|
+
]);
|
|
235
|
+
const shipId = precondition.shipId;
|
|
236
|
+
if (typeof shipId !== 'number' ||
|
|
237
|
+
!Number.isInteger(shipId) ||
|
|
238
|
+
shipId < 0 ||
|
|
239
|
+
shipId > 65535)
|
|
240
|
+
invalid(`${field}.shipId`, shipId, 'an unsigned u16 ship configuration ID');
|
|
241
|
+
const maximumProfileDebit = precondition.maximumProfileDebit;
|
|
242
|
+
if (typeof maximumProfileDebit !== 'bigint' || maximumProfileDebit < 0n)
|
|
243
|
+
invalid(`${field}.maximumProfileDebit`, maximumProfileDebit, 'a nonnegative bigint');
|
|
244
|
+
return Object.freeze({
|
|
245
|
+
kind: 'ship-import-funding',
|
|
246
|
+
address: readAddress(precondition.address, `${field}.address`),
|
|
247
|
+
game: readAddress(precondition.game, `${field}.game`),
|
|
248
|
+
profile: readAddress(precondition.profile, `${field}.profile`),
|
|
249
|
+
system: readAddress(precondition.system, `${field}.system`),
|
|
250
|
+
shipId,
|
|
251
|
+
maximumProfileDebit,
|
|
252
|
+
describes: readString(precondition.describes, `${field}.describes`),
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
if (precondition.kind === 'fleet-attack') {
|
|
256
|
+
assertKeys(precondition, field, [
|
|
257
|
+
'kind',
|
|
258
|
+
'address',
|
|
259
|
+
'defender',
|
|
260
|
+
'game',
|
|
261
|
+
'profile',
|
|
262
|
+
'defenderProfile',
|
|
263
|
+
'instructionKey',
|
|
264
|
+
'describes',
|
|
265
|
+
]);
|
|
266
|
+
return Object.freeze({
|
|
267
|
+
kind: 'fleet-attack',
|
|
268
|
+
address: readAddress(precondition.address, `${field}.address`),
|
|
269
|
+
defender: readAddress(precondition.defender, `${field}.defender`),
|
|
270
|
+
game: readAddress(precondition.game, `${field}.game`),
|
|
271
|
+
profile: readAddress(precondition.profile, `${field}.profile`),
|
|
272
|
+
defenderProfile: readAddress(precondition.defenderProfile, `${field}.defenderProfile`),
|
|
273
|
+
instructionKey: readString(precondition.instructionKey, `${field}.instructionKey`),
|
|
274
|
+
describes: readString(precondition.describes, `${field}.describes`),
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
if (precondition.kind === 'movement-character') {
|
|
278
|
+
assertKeys(precondition, field, [
|
|
279
|
+
'kind',
|
|
280
|
+
'address',
|
|
281
|
+
'game',
|
|
282
|
+
'profile',
|
|
283
|
+
'stateHash',
|
|
284
|
+
'describes',
|
|
285
|
+
]);
|
|
286
|
+
return Object.freeze({
|
|
287
|
+
kind: 'movement-character',
|
|
288
|
+
address: readAddress(precondition.address, `${field}.address`),
|
|
289
|
+
game: readAddress(precondition.game, `${field}.game`),
|
|
290
|
+
profile: readAddress(precondition.profile, `${field}.profile`),
|
|
291
|
+
stateHash: readDataHash(precondition.stateHash, `${field}.stateHash`),
|
|
292
|
+
describes: readString(precondition.describes, `${field}.describes`),
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
if (precondition.kind === 'starbase-system') {
|
|
296
|
+
assertKeys(precondition, field, ['kind', 'address', 'game', 'starbaseSequenceId', 'describes'], ['requireCss']);
|
|
297
|
+
if (precondition.requireCss !== undefined &&
|
|
298
|
+
precondition.requireCss !== true)
|
|
299
|
+
invalid(`${field}.requireCss`, precondition.requireCss, 'true when CSS access is required, otherwise omitted');
|
|
300
|
+
const sequence = precondition.starbaseSequenceId;
|
|
301
|
+
if (typeof sequence !== 'bigint' ||
|
|
302
|
+
sequence < 0n ||
|
|
303
|
+
sequence > 18446744073709551615n)
|
|
304
|
+
invalid(`${field}.starbaseSequenceId`, sequence, 'an unsigned u64 Starbase sequence');
|
|
305
|
+
return Object.freeze({
|
|
306
|
+
kind: 'starbase-system',
|
|
307
|
+
address: readAddress(precondition.address, `${field}.address`),
|
|
308
|
+
game: readAddress(precondition.game, `${field}.game`),
|
|
309
|
+
starbaseSequenceId: sequence,
|
|
310
|
+
...(precondition.requireCss === undefined
|
|
311
|
+
? {}
|
|
312
|
+
: { requireCss: true }),
|
|
313
|
+
describes: readString(precondition.describes, `${field}.describes`),
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
if (precondition.kind === 'fleet-mining') {
|
|
317
|
+
assertKeys(precondition, field, [
|
|
318
|
+
'kind',
|
|
319
|
+
'address',
|
|
320
|
+
'game',
|
|
321
|
+
'profile',
|
|
322
|
+
'asteroid',
|
|
323
|
+
'describes',
|
|
324
|
+
]);
|
|
325
|
+
return Object.freeze({
|
|
326
|
+
kind: 'fleet-mining',
|
|
327
|
+
address: readAddress(precondition.address, `${field}.address`),
|
|
328
|
+
game: readAddress(precondition.game, `${field}.game`),
|
|
329
|
+
profile: readAddress(precondition.profile, `${field}.profile`),
|
|
330
|
+
asteroid: readAddress(precondition.asteroid, `${field}.asteroid`),
|
|
331
|
+
describes: readString(precondition.describes, `${field}.describes`),
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
if (isFactionTradeGuard(precondition)) {
|
|
335
|
+
const kind = precondition.kind;
|
|
336
|
+
assertKeys(precondition, field, [
|
|
337
|
+
'kind',
|
|
338
|
+
'address',
|
|
339
|
+
'game',
|
|
340
|
+
'factionId',
|
|
341
|
+
'describes',
|
|
342
|
+
'schemaVersion',
|
|
343
|
+
...(isTradeBuyGuard(precondition)
|
|
344
|
+
? ['cargoId', 'floorRaw']
|
|
345
|
+
: isTradeSellGuard(precondition)
|
|
346
|
+
? ['atlasOutCapPerEpochRaw', 'epochLengthSeconds']
|
|
347
|
+
: []),
|
|
348
|
+
]);
|
|
349
|
+
const unsigned = (key, max = 65535) => {
|
|
350
|
+
const n = precondition[key];
|
|
351
|
+
if (typeof n !== 'number' || !Number.isInteger(n) || n < 0 || n > max)
|
|
352
|
+
invalid(`${field}.${key}`, n, `an unsigned ${max === 255 ? 'u8' : 'u16'} integer`);
|
|
353
|
+
return n;
|
|
354
|
+
};
|
|
355
|
+
const integer = (key, signed = false) => {
|
|
356
|
+
const n = precondition[key];
|
|
357
|
+
const min = signed ? -(1n << 63n) : 0n;
|
|
358
|
+
const max = signed ? (1n << 63n) - 1n : (1n << 64n) - 1n;
|
|
359
|
+
if (typeof n !== 'bigint' || n < min || n > max)
|
|
360
|
+
invalid(`${field}.${key}`, n, signed ? 'an i64 bigint' : 'a u64 bigint');
|
|
361
|
+
return n;
|
|
362
|
+
};
|
|
363
|
+
const common = {
|
|
364
|
+
address: readAddress(precondition.address, `${field}.address`),
|
|
365
|
+
game: readAddress(precondition.game, `${field}.game`),
|
|
366
|
+
factionId: unsigned('factionId'),
|
|
367
|
+
schemaVersion: unsigned('schemaVersion', 255),
|
|
368
|
+
describes: readString(precondition.describes, `${field}.describes`),
|
|
369
|
+
};
|
|
370
|
+
if (isTradeBuyGuard(precondition))
|
|
371
|
+
return Object.freeze({
|
|
372
|
+
kind,
|
|
373
|
+
...common,
|
|
374
|
+
cargoId: unsigned('cargoId'),
|
|
375
|
+
floorRaw: integer('floorRaw'),
|
|
376
|
+
});
|
|
377
|
+
if (isTradeSellGuard(precondition))
|
|
378
|
+
return Object.freeze({
|
|
379
|
+
kind,
|
|
380
|
+
...common,
|
|
381
|
+
atlasOutCapPerEpochRaw: integer('atlasOutCapPerEpochRaw'),
|
|
382
|
+
epochLengthSeconds: integer('epochLengthSeconds', true),
|
|
383
|
+
});
|
|
384
|
+
return Object.freeze({ kind, ...common });
|
|
385
|
+
}
|
|
386
|
+
if (precondition.kind === 'fleet-add-ship') {
|
|
387
|
+
assertKeys(precondition, field, [
|
|
388
|
+
'kind',
|
|
389
|
+
'address',
|
|
390
|
+
'game',
|
|
391
|
+
'profile',
|
|
392
|
+
'authority',
|
|
393
|
+
'system',
|
|
394
|
+
'shipId',
|
|
395
|
+
'amount',
|
|
396
|
+
'keyIndex',
|
|
397
|
+
'configHash',
|
|
398
|
+
'maximumProfileDebit',
|
|
399
|
+
'describes',
|
|
400
|
+
]);
|
|
401
|
+
const keyIndex = precondition.keyIndex;
|
|
402
|
+
if (typeof keyIndex !== 'number' ||
|
|
403
|
+
!Number.isInteger(keyIndex) ||
|
|
404
|
+
keyIndex < 0 ||
|
|
405
|
+
keyIndex > 65535)
|
|
406
|
+
invalid(`${field}.keyIndex`, keyIndex, 'an integer from 0 through 65535');
|
|
407
|
+
const shipId = precondition.shipId;
|
|
408
|
+
if (typeof shipId !== 'number' ||
|
|
409
|
+
!Number.isInteger(shipId) ||
|
|
410
|
+
shipId < 0 ||
|
|
411
|
+
shipId > 65535)
|
|
412
|
+
invalid(`${field}.shipId`, shipId, 'a u16 ship configuration ID');
|
|
413
|
+
const amount = precondition.amount;
|
|
414
|
+
if (typeof amount !== 'bigint' || amount < 1n || amount > 255n)
|
|
415
|
+
invalid(`${field}.amount`, amount, 'a whole ship quantity from 1n through 255n');
|
|
416
|
+
const maximumProfileDebit = precondition.maximumProfileDebit;
|
|
417
|
+
if (typeof maximumProfileDebit !== 'bigint' || maximumProfileDebit < 0n)
|
|
418
|
+
invalid(`${field}.maximumProfileDebit`, maximumProfileDebit, 'a nonnegative bigint');
|
|
419
|
+
return Object.freeze({
|
|
420
|
+
kind: 'fleet-add-ship',
|
|
421
|
+
address: readAddress(precondition.address, `${field}.address`),
|
|
422
|
+
game: readAddress(precondition.game, `${field}.game`),
|
|
423
|
+
profile: readAddress(precondition.profile, `${field}.profile`),
|
|
424
|
+
authority: readAddress(precondition.authority, `${field}.authority`),
|
|
425
|
+
system: readAddress(precondition.system, `${field}.system`),
|
|
426
|
+
keyIndex,
|
|
427
|
+
shipId,
|
|
428
|
+
amount,
|
|
429
|
+
maximumProfileDebit,
|
|
430
|
+
configHash: readDataHash(precondition.configHash, `${field}.configHash`),
|
|
431
|
+
describes: readString(precondition.describes, `${field}.describes`),
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
if (precondition.kind === 'scan-completion') {
|
|
435
|
+
const addresses = [
|
|
436
|
+
'address',
|
|
437
|
+
'game',
|
|
438
|
+
'signal',
|
|
439
|
+
'profile',
|
|
440
|
+
'character',
|
|
441
|
+
'authority',
|
|
442
|
+
'policy',
|
|
443
|
+
'loot',
|
|
444
|
+
'xpBudget',
|
|
445
|
+
'xpConfig',
|
|
446
|
+
];
|
|
447
|
+
assertKeys(precondition, field, [
|
|
448
|
+
'kind',
|
|
449
|
+
'operation',
|
|
450
|
+
...addresses,
|
|
451
|
+
'keyIndex',
|
|
452
|
+
'status',
|
|
453
|
+
'expectedSequence',
|
|
454
|
+
'configHash',
|
|
455
|
+
'describes',
|
|
456
|
+
]);
|
|
457
|
+
if (typeof precondition.operation !== 'string' ||
|
|
458
|
+
!Object.hasOwn(scanCompletionDiscriminators, precondition.operation))
|
|
459
|
+
invalid(field, precondition.operation, 'a supported scan lifecycle operation');
|
|
460
|
+
const keyIndex = precondition.keyIndex, status = precondition.status, sequence = precondition.expectedSequence;
|
|
461
|
+
if (typeof keyIndex !== 'number' ||
|
|
462
|
+
!Number.isInteger(keyIndex) ||
|
|
463
|
+
keyIndex < 0 ||
|
|
464
|
+
keyIndex > 65535)
|
|
465
|
+
invalid(field, keyIndex, 'a u16 key index');
|
|
466
|
+
if (typeof status !== 'number' ||
|
|
467
|
+
!Number.isInteger(status) ||
|
|
468
|
+
status < 1 ||
|
|
469
|
+
status > 6)
|
|
470
|
+
invalid(field, status, 'a current nonempty signal state');
|
|
471
|
+
if (typeof sequence !== 'bigint' ||
|
|
472
|
+
sequence < 0n ||
|
|
473
|
+
sequence > 18446744073709551615n)
|
|
474
|
+
invalid(field, sequence, 'a u64 sequence');
|
|
475
|
+
const parsed = Object.fromEntries(addresses.map((k) => [k, readAddress(precondition[k], `${field}.${k}`)]));
|
|
476
|
+
return Object.freeze({
|
|
477
|
+
kind: 'scan-completion',
|
|
478
|
+
operation: precondition.operation,
|
|
479
|
+
...parsed,
|
|
480
|
+
keyIndex,
|
|
481
|
+
status,
|
|
482
|
+
expectedSequence: sequence,
|
|
483
|
+
configHash: readDataHash(precondition.configHash, field),
|
|
484
|
+
describes: readString(precondition.describes, field),
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
if (precondition.kind === 'scan-detect') {
|
|
488
|
+
assertKeys(precondition, field, [
|
|
489
|
+
'kind',
|
|
490
|
+
'address',
|
|
491
|
+
'game',
|
|
492
|
+
'profile',
|
|
493
|
+
'authority',
|
|
494
|
+
'character',
|
|
495
|
+
'signal',
|
|
496
|
+
'pattern',
|
|
497
|
+
'policy',
|
|
498
|
+
'loot',
|
|
499
|
+
'tracker',
|
|
500
|
+
'keyIndex',
|
|
501
|
+
'patternId',
|
|
502
|
+
'focus',
|
|
503
|
+
'expectedSequence',
|
|
504
|
+
'policyRevision',
|
|
505
|
+
'profileRevision',
|
|
506
|
+
'configHash',
|
|
507
|
+
'describes',
|
|
508
|
+
]);
|
|
509
|
+
const numbers = {};
|
|
510
|
+
for (const [key, max] of [
|
|
511
|
+
['keyIndex', 65535],
|
|
512
|
+
['patternId', 65535],
|
|
513
|
+
['focus', 4],
|
|
514
|
+
['policyRevision', 4294967295],
|
|
515
|
+
['profileRevision', 4294967295],
|
|
516
|
+
]) {
|
|
517
|
+
const value = precondition[key];
|
|
518
|
+
if (typeof value !== 'number' ||
|
|
519
|
+
!Number.isInteger(value) ||
|
|
520
|
+
value < 0 ||
|
|
521
|
+
value > max)
|
|
522
|
+
invalid(`${field}.${key}`, value, `an integer from zero through ${max}`);
|
|
523
|
+
numbers[key] = value;
|
|
524
|
+
}
|
|
525
|
+
const sequence = precondition.expectedSequence;
|
|
526
|
+
if (typeof sequence !== 'bigint' ||
|
|
527
|
+
sequence < 0n ||
|
|
528
|
+
sequence > 18446744073709551615n)
|
|
529
|
+
invalid(`${field}.expectedSequence`, sequence, 'a u64 bigint');
|
|
530
|
+
return Object.freeze({
|
|
531
|
+
kind: 'scan-detect',
|
|
532
|
+
address: readAddress(precondition.address, field),
|
|
533
|
+
game: readAddress(precondition.game, field),
|
|
534
|
+
profile: readAddress(precondition.profile, field),
|
|
535
|
+
authority: readAddress(precondition.authority, field),
|
|
536
|
+
character: readAddress(precondition.character, field),
|
|
537
|
+
signal: readAddress(precondition.signal, field),
|
|
538
|
+
pattern: readAddress(precondition.pattern, field),
|
|
539
|
+
policy: readAddress(precondition.policy, field),
|
|
540
|
+
loot: readAddress(precondition.loot, field),
|
|
541
|
+
tracker: readAddress(precondition.tracker, field),
|
|
542
|
+
keyIndex: numbers.keyIndex,
|
|
543
|
+
patternId: numbers.patternId,
|
|
544
|
+
focus: numbers.focus,
|
|
545
|
+
policyRevision: numbers.policyRevision,
|
|
546
|
+
profileRevision: numbers.profileRevision,
|
|
547
|
+
expectedSequence: sequence,
|
|
548
|
+
configHash: readDataHash(precondition.configHash, field),
|
|
549
|
+
describes: readString(precondition.describes, field),
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
if (precondition.kind === 'fleet-crew-transfer') {
|
|
553
|
+
assertKeys(precondition, field, [
|
|
554
|
+
'kind',
|
|
555
|
+
'direction',
|
|
556
|
+
'address',
|
|
557
|
+
'game',
|
|
558
|
+
'profile',
|
|
559
|
+
'authority',
|
|
560
|
+
'system',
|
|
561
|
+
'starbasePlayer',
|
|
562
|
+
'keyIndex',
|
|
563
|
+
'count',
|
|
564
|
+
'systemSequenceId',
|
|
565
|
+
'describes',
|
|
566
|
+
]);
|
|
567
|
+
for (const key of ['count', 'keyIndex']) {
|
|
568
|
+
const n = precondition[key];
|
|
569
|
+
if (typeof n !== 'number' ||
|
|
570
|
+
!Number.isInteger(n) ||
|
|
571
|
+
n < (key === 'count' ? 1 : 0) ||
|
|
572
|
+
n > 65535)
|
|
573
|
+
invalid(field, n, 'a positive u16 count and u16 key index');
|
|
574
|
+
}
|
|
575
|
+
const direction = precondition.direction, sequence = precondition.systemSequenceId;
|
|
576
|
+
if (direction !== 'load' && direction !== 'unload')
|
|
577
|
+
invalid(field, direction, 'load or unload');
|
|
578
|
+
if (typeof sequence !== 'bigint' ||
|
|
579
|
+
sequence < 0n ||
|
|
580
|
+
sequence > (1n << 64n) - 1n)
|
|
581
|
+
invalid(field, sequence, 'a u64 System generation');
|
|
582
|
+
return Object.freeze({
|
|
583
|
+
kind: 'fleet-crew-transfer',
|
|
584
|
+
direction,
|
|
585
|
+
address: readAddress(precondition.address, field),
|
|
586
|
+
game: readAddress(precondition.game, field),
|
|
587
|
+
profile: readAddress(precondition.profile, field),
|
|
588
|
+
authority: readAddress(precondition.authority, field),
|
|
589
|
+
system: readAddress(precondition.system, field),
|
|
590
|
+
starbasePlayer: readAddress(precondition.starbasePlayer, field),
|
|
591
|
+
count: precondition.count,
|
|
592
|
+
keyIndex: precondition.keyIndex,
|
|
593
|
+
systemSequenceId: sequence,
|
|
594
|
+
describes: readString(precondition.describes, field),
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
if (precondition.kind === 'fleet-respawn') {
|
|
598
|
+
assertKeys(precondition, field, [
|
|
599
|
+
'kind',
|
|
600
|
+
'address',
|
|
601
|
+
'game',
|
|
602
|
+
'profile',
|
|
603
|
+
'authority',
|
|
604
|
+
'system',
|
|
605
|
+
'keyIndex',
|
|
606
|
+
'phase',
|
|
607
|
+
'fleetHash',
|
|
608
|
+
'maximumRecoveryFee',
|
|
609
|
+
'maximumProfileDebit',
|
|
610
|
+
'describes',
|
|
611
|
+
]);
|
|
612
|
+
const keyIndex = precondition.keyIndex;
|
|
613
|
+
if (typeof keyIndex !== 'number' ||
|
|
614
|
+
!Number.isInteger(keyIndex) ||
|
|
615
|
+
keyIndex < 0 ||
|
|
616
|
+
keyIndex > 65535)
|
|
617
|
+
invalid(`${field}.keyIndex`, keyIndex, 'a u16 key index');
|
|
618
|
+
const phase = precondition.phase;
|
|
619
|
+
if (phase !== 'start' && phase !== 'complete')
|
|
620
|
+
invalid(`${field}.phase`, phase, 'start or complete');
|
|
621
|
+
const maximumRecoveryFee = precondition.maximumRecoveryFee, maximumProfileDebit = precondition.maximumProfileDebit;
|
|
622
|
+
for (const value of [maximumRecoveryFee, maximumProfileDebit])
|
|
623
|
+
if (typeof value !== 'bigint' || value < 0n || value > (1n << 64n) - 1n)
|
|
624
|
+
invalid(field, value, 'a nonnegative u64 funding ceiling');
|
|
625
|
+
return Object.freeze({
|
|
626
|
+
kind: 'fleet-respawn',
|
|
627
|
+
address: readAddress(precondition.address, field),
|
|
628
|
+
game: readAddress(precondition.game, field),
|
|
629
|
+
profile: readAddress(precondition.profile, field),
|
|
630
|
+
authority: readAddress(precondition.authority, field),
|
|
631
|
+
system: readAddress(precondition.system, field),
|
|
632
|
+
keyIndex,
|
|
633
|
+
phase,
|
|
634
|
+
fleetHash: readDataHash(precondition.fleetHash, field),
|
|
635
|
+
maximumRecoveryFee: maximumRecoveryFee,
|
|
636
|
+
maximumProfileDebit: maximumProfileDebit,
|
|
637
|
+
describes: readString(precondition.describes, field),
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
if (precondition.kind === 'scan-signal-open') {
|
|
641
|
+
assertKeys(precondition, field, [
|
|
642
|
+
'kind',
|
|
643
|
+
'address',
|
|
644
|
+
'game',
|
|
645
|
+
'fleet',
|
|
646
|
+
'profile',
|
|
647
|
+
'authority',
|
|
648
|
+
'character',
|
|
649
|
+
'keyIndex',
|
|
650
|
+
'authorityHash',
|
|
651
|
+
'maximumProfileDebit',
|
|
652
|
+
'describes',
|
|
653
|
+
]);
|
|
654
|
+
const keyIndex = precondition.keyIndex;
|
|
655
|
+
if (typeof keyIndex !== 'number' ||
|
|
656
|
+
!Number.isInteger(keyIndex) ||
|
|
657
|
+
keyIndex < 0 ||
|
|
658
|
+
keyIndex > 65535)
|
|
659
|
+
invalid(field, keyIndex, 'a u16 key index');
|
|
660
|
+
const maximumProfileDebit = precondition.maximumProfileDebit;
|
|
661
|
+
if (typeof maximumProfileDebit !== 'bigint' ||
|
|
662
|
+
maximumProfileDebit < 0n ||
|
|
663
|
+
maximumProfileDebit > 0xffffffffffffffffn)
|
|
664
|
+
invalid(field, maximumProfileDebit, 'a nonnegative u64 funding ceiling');
|
|
665
|
+
return Object.freeze({
|
|
666
|
+
kind: 'scan-signal-open',
|
|
667
|
+
authorityHash: readDataHash(precondition.authorityHash, field),
|
|
668
|
+
address: readAddress(precondition.address, field),
|
|
669
|
+
game: readAddress(precondition.game, field),
|
|
670
|
+
fleet: readAddress(precondition.fleet, field),
|
|
671
|
+
profile: readAddress(precondition.profile, field),
|
|
672
|
+
authority: readAddress(precondition.authority, field),
|
|
673
|
+
character: readAddress(precondition.character, field),
|
|
674
|
+
keyIndex,
|
|
675
|
+
maximumProfileDebit,
|
|
676
|
+
describes: readString(precondition.describes, field),
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
if (precondition.kind === 'fleet-create') {
|
|
680
|
+
assertKeys(precondition, field, [
|
|
681
|
+
'kind',
|
|
682
|
+
'address',
|
|
683
|
+
'game',
|
|
684
|
+
'profile',
|
|
685
|
+
'authority',
|
|
686
|
+
'system',
|
|
687
|
+
'keyIndex',
|
|
688
|
+
'label',
|
|
689
|
+
'maximumProfileDebit',
|
|
690
|
+
'describes',
|
|
691
|
+
]);
|
|
692
|
+
const keyIndex = precondition.keyIndex;
|
|
693
|
+
if (typeof keyIndex !== 'number' ||
|
|
694
|
+
!Number.isSafeInteger(keyIndex) ||
|
|
695
|
+
keyIndex < 0 ||
|
|
696
|
+
keyIndex > 65_535)
|
|
697
|
+
invalid(`${field}.keyIndex`, keyIndex, 'an integer from 0 through 65535');
|
|
698
|
+
const label = readString(precondition.label, `${field}.label`);
|
|
699
|
+
const bytes = new TextEncoder().encode(label);
|
|
700
|
+
if (label.trim().length === 0 ||
|
|
701
|
+
label.includes('\0') ||
|
|
702
|
+
bytes.length > 64 ||
|
|
703
|
+
new TextDecoder('utf-8', { ignoreBOM: true }).decode(bytes) !== label)
|
|
704
|
+
invalid(`${field}.label`, label, 'a nonblank, NUL-free Unicode label of at most 64 UTF-8 bytes');
|
|
705
|
+
const maximumProfileDebit = precondition.maximumProfileDebit;
|
|
706
|
+
if (typeof maximumProfileDebit !== 'bigint' || maximumProfileDebit < 0n)
|
|
707
|
+
invalid(`${field}.maximumProfileDebit`, maximumProfileDebit, 'a nonnegative bigint');
|
|
708
|
+
return Object.freeze({
|
|
709
|
+
kind: 'fleet-create',
|
|
710
|
+
address: readAddress(precondition.address, `${field}.address`),
|
|
711
|
+
game: readAddress(precondition.game, `${field}.game`),
|
|
712
|
+
profile: readAddress(precondition.profile, `${field}.profile`),
|
|
713
|
+
authority: readAddress(precondition.authority, `${field}.authority`),
|
|
714
|
+
system: readAddress(precondition.system, `${field}.system`),
|
|
715
|
+
keyIndex,
|
|
716
|
+
label,
|
|
717
|
+
maximumProfileDebit,
|
|
718
|
+
describes: readString(precondition.describes, `${field}.describes`),
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
if (precondition.kind === 'system-account-or-absent') {
|
|
722
|
+
assertKeys(precondition, field, ['kind', 'address', 'describes']);
|
|
723
|
+
return Object.freeze({
|
|
724
|
+
kind: 'system-account-or-absent',
|
|
725
|
+
address: readAddress(precondition.address, `${field}.address`),
|
|
726
|
+
describes: readString(precondition.describes, `${field}.describes`),
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
if (precondition.kind === 'token-mint') {
|
|
730
|
+
assertKeys(precondition, field, [
|
|
731
|
+
'kind',
|
|
732
|
+
'address',
|
|
733
|
+
'decimals',
|
|
734
|
+
'describes',
|
|
735
|
+
]);
|
|
736
|
+
const decimals = precondition.decimals;
|
|
737
|
+
if (typeof decimals !== 'number' ||
|
|
738
|
+
!Number.isInteger(decimals) ||
|
|
739
|
+
decimals < 0 ||
|
|
740
|
+
decimals > 255)
|
|
741
|
+
invalid(`${field}.decimals`, decimals, 'an unsigned u8 mint decimals value');
|
|
742
|
+
return Object.freeze({
|
|
743
|
+
kind: 'token-mint',
|
|
744
|
+
address: readAddress(precondition.address, `${field}.address`),
|
|
745
|
+
decimals,
|
|
746
|
+
describes: readString(precondition.describes, `${field}.describes`),
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
if (precondition.kind === 'game-ship-config') {
|
|
165
750
|
assertKeys(precondition, field, [
|
|
166
751
|
'kind',
|
|
167
752
|
'address',
|
|
@@ -180,7 +765,7 @@ function normalizePrecondition(value, field, version = 6) {
|
|
|
180
765
|
describes: readString(precondition.describes, `${field}.describes`),
|
|
181
766
|
});
|
|
182
767
|
}
|
|
183
|
-
if (
|
|
768
|
+
if (precondition.kind === 'game-account') {
|
|
184
769
|
assertKeys(precondition, field, ['kind', 'address', 'describes']);
|
|
185
770
|
return Object.freeze({
|
|
186
771
|
kind: 'game-account',
|
|
@@ -188,8 +773,7 @@ function normalizePrecondition(value, field, version = 6) {
|
|
|
188
773
|
describes: readString(precondition.describes, `${field}.describes`),
|
|
189
774
|
});
|
|
190
775
|
}
|
|
191
|
-
if (
|
|
192
|
-
['token-account', 'game-cargo-config', 'cargo-cache'].includes(String(precondition.kind))) {
|
|
776
|
+
if (['game-cargo-bytes-config', 'token-account', 'cargo-cache'].includes(String(precondition.kind))) {
|
|
193
777
|
const base = {
|
|
194
778
|
address: readAddress(precondition.address, `${field}.address`),
|
|
195
779
|
describes: readString(precondition.describes, `${field}.describes`),
|
|
@@ -216,7 +800,7 @@ function normalizePrecondition(value, field, version = 6) {
|
|
|
216
800
|
minimumBalance: amount,
|
|
217
801
|
});
|
|
218
802
|
}
|
|
219
|
-
if (precondition.kind === 'game-cargo-config') {
|
|
803
|
+
if (precondition.kind === 'game-cargo-bytes-config') {
|
|
220
804
|
assertKeys(precondition, field, [
|
|
221
805
|
'kind',
|
|
222
806
|
'address',
|
|
@@ -232,7 +816,7 @@ function normalizePrecondition(value, field, version = 6) {
|
|
|
232
816
|
invalid(`${field}.cargoId`, id, 'a u16 cargo ID');
|
|
233
817
|
return Object.freeze({
|
|
234
818
|
...base,
|
|
235
|
-
kind:
|
|
819
|
+
kind: precondition.kind,
|
|
236
820
|
cargoId: id,
|
|
237
821
|
configHash: readDataHash(precondition.configHash, `${field}.configHash`),
|
|
238
822
|
});
|
|
@@ -257,7 +841,7 @@ function normalizePrecondition(value, field, version = 6) {
|
|
|
257
841
|
bump,
|
|
258
842
|
});
|
|
259
843
|
}
|
|
260
|
-
if (precondition.kind === 'token-account-or-absent'
|
|
844
|
+
if (precondition.kind === 'token-account-or-absent') {
|
|
261
845
|
assertKeys(precondition, field, [
|
|
262
846
|
'kind',
|
|
263
847
|
'address',
|
|
@@ -273,7 +857,7 @@ function normalizePrecondition(value, field, version = 6) {
|
|
|
273
857
|
describes: readString(precondition.describes, `${field}.describes`),
|
|
274
858
|
});
|
|
275
859
|
}
|
|
276
|
-
if (precondition.kind === 'account-absent'
|
|
860
|
+
if (precondition.kind === 'account-absent') {
|
|
277
861
|
assertKeys(precondition, field, ['kind', 'address', 'describes']);
|
|
278
862
|
return Object.freeze({
|
|
279
863
|
kind: 'account-absent',
|
|
@@ -282,17 +866,7 @@ function normalizePrecondition(value, field, version = 6) {
|
|
|
282
866
|
});
|
|
283
867
|
}
|
|
284
868
|
if (precondition.kind !== 'account-state') {
|
|
285
|
-
invalid(`${field}.kind`, precondition.kind,
|
|
286
|
-
? 'one of account-state, account-absent, token-account-or-absent, token-account, game-cargo-config, cargo-cache, game-account, or game-ship-config'
|
|
287
|
-
: version === 5
|
|
288
|
-
? 'one of account-state, account-absent, token-account-or-absent, token-account, game-cargo-config, cargo-cache, or game-account'
|
|
289
|
-
: version === 4
|
|
290
|
-
? 'one of account-state, account-absent, token-account-or-absent, token-account, game-cargo-config, or cargo-cache'
|
|
291
|
-
: version === 3
|
|
292
|
-
? 'one of account-state, account-absent, or token-account-or-absent'
|
|
293
|
-
: version === 2
|
|
294
|
-
? 'one of account-state or account-absent'
|
|
295
|
-
: 'the value account-state');
|
|
869
|
+
invalid(`${field}.kind`, precondition.kind, 'a supported current Plan guard; recreate the Plan using the current capability planner');
|
|
296
870
|
}
|
|
297
871
|
assertKeys(precondition, field, ['kind', 'address', 'dataHash', 'describes']);
|
|
298
872
|
return Object.freeze({
|
|
@@ -328,84 +902,72 @@ function instructionToJSON(instruction) {
|
|
|
328
902
|
return deepFreeze(value);
|
|
329
903
|
}
|
|
330
904
|
function planToJSON(plan) {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
const common = {
|
|
905
|
+
return deepFreeze({
|
|
906
|
+
v: 24,
|
|
334
907
|
kind: plan.kind,
|
|
335
908
|
summary: plan.summary,
|
|
336
909
|
affected: [...plan.affected],
|
|
337
910
|
requiredSigners: [...plan.requiredSigners],
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
:
|
|
345
|
-
signers: [...step.signers],
|
|
346
|
-
}));
|
|
347
|
-
if (plan.preconditions.some(({ kind }) => kind === 'game-ship-config')) {
|
|
348
|
-
return deepFreeze({
|
|
349
|
-
v: 6,
|
|
350
|
-
...common,
|
|
351
|
-
steps,
|
|
352
|
-
preconditions: plan.preconditions.map((guard) => guard.kind === 'token-account'
|
|
353
|
-
? { ...guard, minimumBalance: String(guard.minimumBalance) }
|
|
354
|
-
: { ...guard }),
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
if (plan.preconditions.some(({ kind }) => kind === 'game-account')) {
|
|
358
|
-
return deepFreeze({
|
|
359
|
-
v: 5,
|
|
360
|
-
...common,
|
|
361
|
-
steps,
|
|
362
|
-
preconditions: plan.preconditions.map((guard) => guard.kind === 'token-account'
|
|
363
|
-
? { ...guard, minimumBalance: String(guard.minimumBalance) }
|
|
364
|
-
: { ...guard }),
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
if (plan.preconditions.some(({ kind }) => kind === 'token-account' ||
|
|
368
|
-
kind === 'game-cargo-config' ||
|
|
369
|
-
kind === 'cargo-cache')) {
|
|
370
|
-
return deepFreeze({
|
|
371
|
-
v: 4,
|
|
372
|
-
...common,
|
|
373
|
-
steps,
|
|
374
|
-
preconditions: plan.preconditions.map((guard) => guard.kind === 'token-account'
|
|
375
|
-
? { ...guard, minimumBalance: String(guard.minimumBalance) }
|
|
376
|
-
: { ...guard }),
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
if (plan.preconditions.some(({ kind }) => kind === 'token-account-or-absent')) {
|
|
380
|
-
return deepFreeze({
|
|
381
|
-
v: 3,
|
|
382
|
-
...common,
|
|
383
|
-
steps,
|
|
384
|
-
preconditions: plan.preconditions.map((guard) => ({
|
|
385
|
-
...guard,
|
|
386
|
-
})),
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
if (hasSemantics || hasAbsentPrecondition) {
|
|
390
|
-
return deepFreeze({
|
|
391
|
-
v: 2,
|
|
392
|
-
...common,
|
|
393
|
-
steps,
|
|
394
|
-
preconditions: plan.preconditions.map((guard) => ({
|
|
395
|
-
...guard,
|
|
396
|
-
})),
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
return deepFreeze({
|
|
400
|
-
v: 1,
|
|
401
|
-
...common,
|
|
402
|
-
steps,
|
|
403
|
-
preconditions: plan.preconditions.map((precondition) => ({
|
|
404
|
-
kind: 'account-state',
|
|
405
|
-
address: precondition.address,
|
|
406
|
-
dataHash: precondition.dataHash,
|
|
407
|
-
describes: precondition.describes,
|
|
911
|
+
steps: plan.steps.map((step) => ({
|
|
912
|
+
instruction: instructionToJSON(step.instruction),
|
|
913
|
+
describes: step.describes,
|
|
914
|
+
...((step.semantics?.length ?? 0) > 0
|
|
915
|
+
? { semantics: step.semantics.map((semantic) => ({ ...semantic })) }
|
|
916
|
+
: {}),
|
|
917
|
+
signers: [...step.signers],
|
|
408
918
|
})),
|
|
919
|
+
preconditions: plan.preconditions.map((guard) => {
|
|
920
|
+
if (guard.kind === 'scan-detect' || guard.kind === 'scan-completion')
|
|
921
|
+
return { ...guard, expectedSequence: String(guard.expectedSequence) };
|
|
922
|
+
if (guard.kind === 'fleet-arrival')
|
|
923
|
+
return arrivalGuardToJSON(guard);
|
|
924
|
+
if (guard.kind === 'fleet-crew-transfer')
|
|
925
|
+
return { ...guard, systemSequenceId: String(guard.systemSequenceId) };
|
|
926
|
+
if (guard.kind === 'fleet-respawn')
|
|
927
|
+
return {
|
|
928
|
+
...guard,
|
|
929
|
+
maximumRecoveryFee: String(guard.maximumRecoveryFee),
|
|
930
|
+
maximumProfileDebit: String(guard.maximumProfileDebit),
|
|
931
|
+
};
|
|
932
|
+
if (isRuntimeGuard(guard))
|
|
933
|
+
return runtimeGuardToJSON(guard);
|
|
934
|
+
if (isTradeBuyGuard(guard))
|
|
935
|
+
return { ...guard, floorRaw: String(guard.floorRaw) };
|
|
936
|
+
if (isTradeSellGuard(guard))
|
|
937
|
+
return {
|
|
938
|
+
...guard,
|
|
939
|
+
atlasOutCapPerEpochRaw: String(guard.atlasOutCapPerEpochRaw),
|
|
940
|
+
epochLengthSeconds: String(guard.epochLengthSeconds),
|
|
941
|
+
};
|
|
942
|
+
if (guard.kind === 'fleet-add-ship')
|
|
943
|
+
return {
|
|
944
|
+
...guard,
|
|
945
|
+
amount: String(guard.amount),
|
|
946
|
+
maximumProfileDebit: String(guard.maximumProfileDebit),
|
|
947
|
+
};
|
|
948
|
+
if (guard.kind === 'character-registration')
|
|
949
|
+
return {
|
|
950
|
+
...guard,
|
|
951
|
+
maximumFunderDebit: String(guard.maximumFunderDebit),
|
|
952
|
+
characterLamports: String(guard.characterLamports),
|
|
953
|
+
budgetLamports: String(guard.budgetLamports),
|
|
954
|
+
};
|
|
955
|
+
if (guard.kind === 'scan-signal-open' ||
|
|
956
|
+
guard.kind === 'fleet-create' ||
|
|
957
|
+
guard.kind === 'ship-import-funding')
|
|
958
|
+
return {
|
|
959
|
+
...guard,
|
|
960
|
+
maximumProfileDebit: String(guard.maximumProfileDebit),
|
|
961
|
+
};
|
|
962
|
+
if (guard.kind === 'starbase-system')
|
|
963
|
+
return {
|
|
964
|
+
...guard,
|
|
965
|
+
starbaseSequenceId: String(guard.starbaseSequenceId),
|
|
966
|
+
};
|
|
967
|
+
if (guard.kind === 'token-account')
|
|
968
|
+
return { ...guard, minimumBalance: String(guard.minimumBalance) };
|
|
969
|
+
return { ...guard };
|
|
970
|
+
}),
|
|
409
971
|
});
|
|
410
972
|
}
|
|
411
973
|
/** Creates an inert branded Plan while deriving every aggregate field.
|
|
@@ -427,6 +989,13 @@ export function createPlan(input) {
|
|
|
427
989
|
assertKeys(value, 'plan', ['kind', 'summary', 'steps', 'preconditions']);
|
|
428
990
|
const steps = Object.freeze(readArray(value.steps, 'plan.steps').map((step, index) => normalizeStep(step, `plan.steps[${String(index)}]`)));
|
|
429
991
|
const preconditions = Object.freeze(readArray(value.preconditions, 'plan.preconditions').map((precondition, index) => normalizePrecondition(precondition, `plan.preconditions[${String(index)}]`)));
|
|
992
|
+
validateShipImportFundingComposition(preconditions);
|
|
993
|
+
validateStarbaseSystemGuards(steps, preconditions);
|
|
994
|
+
validateDetectInstructions(steps, preconditions);
|
|
995
|
+
validateCompletionInstructions(steps, preconditions);
|
|
996
|
+
validateRespawnInstructions(steps, preconditions);
|
|
997
|
+
validateCrewTransferInstructions(steps, preconditions);
|
|
998
|
+
validateOpenSignalInstructions(steps, preconditions);
|
|
430
999
|
const descriptions = Object.freeze(steps.map((step) => step.describes));
|
|
431
1000
|
const plan = {
|
|
432
1001
|
kind: readString(value.kind, 'plan.kind'),
|
|
@@ -438,7 +1007,6 @@ export function createPlan(input) {
|
|
|
438
1007
|
describe: () => descriptions,
|
|
439
1008
|
toJSON: () => planToJSON(plan),
|
|
440
1009
|
};
|
|
441
|
-
Object.defineProperty(plan, PLAN_BRAND, { value: true });
|
|
442
1010
|
registerPlanInstance(plan);
|
|
443
1011
|
return Object.freeze(plan);
|
|
444
1012
|
}
|
|
@@ -473,7 +1041,7 @@ function sameAddresses(actual, encoded) {
|
|
|
473
1041
|
*
|
|
474
1042
|
* @example
|
|
475
1043
|
* ```ts
|
|
476
|
-
* declare const wire:
|
|
1044
|
+
* declare const wire: PlanJson;
|
|
477
1045
|
* const plan = planFromJSON(wire);
|
|
478
1046
|
* console.log(plan.describe());
|
|
479
1047
|
* ```
|
|
@@ -489,34 +1057,112 @@ export function planFromJSON(json) {
|
|
|
489
1057
|
'affected',
|
|
490
1058
|
'requiredSigners',
|
|
491
1059
|
]);
|
|
492
|
-
if (value.v !==
|
|
493
|
-
value.v
|
|
494
|
-
value.v !== 3 &&
|
|
495
|
-
value.v !== 4 &&
|
|
496
|
-
value.v !== 5 &&
|
|
497
|
-
value.v !== 6) {
|
|
498
|
-
invalid('planJson.v', value.v, 'the Plan wire version 1, 2, 3, 4, 5, or 6');
|
|
499
|
-
}
|
|
500
|
-
const version = value.v;
|
|
501
|
-
if (version >= 4 && Array.isArray(value.preconditions)) {
|
|
502
|
-
value.preconditions = value.preconditions.map((entry) => {
|
|
503
|
-
const guard = readRecord(entry, 'precondition');
|
|
504
|
-
if (guard.kind !== 'token-account')
|
|
505
|
-
return guard;
|
|
506
|
-
if (typeof guard.minimumBalance !== 'string' ||
|
|
507
|
-
!/^(0|[1-9][0-9]*)$/.test(guard.minimumBalance))
|
|
508
|
-
invalid('minimumBalance', guard.minimumBalance, 'a canonical unsigned decimal string');
|
|
509
|
-
return { ...guard, minimumBalance: BigInt(guard.minimumBalance) };
|
|
510
|
-
});
|
|
1060
|
+
if (value.v !== 24) {
|
|
1061
|
+
throw new InvalidActionInputError('planJson.v', value.v, 'the current Plan wire version 24', 'Recreate the Plan using the current capability planner; do not change its saved version or migrate its guards.');
|
|
511
1062
|
}
|
|
1063
|
+
value.preconditions = readArray(value.preconditions, 'planJson.preconditions').map((entry) => {
|
|
1064
|
+
const guard = readRecord(entry, 'precondition');
|
|
1065
|
+
if (guard.kind === 'scan-detect' || guard.kind === 'scan-completion') {
|
|
1066
|
+
if (typeof guard.expectedSequence !== 'string' ||
|
|
1067
|
+
!/^(0|[1-9][0-9]*)$/.test(guard.expectedSequence))
|
|
1068
|
+
invalid('expectedSequence', guard.expectedSequence, 'a canonical unsigned decimal string');
|
|
1069
|
+
return { ...guard, expectedSequence: BigInt(guard.expectedSequence) };
|
|
1070
|
+
}
|
|
1071
|
+
if (guard.kind === 'fleet-arrival')
|
|
1072
|
+
return normalizeArrivalGuard(guard, 'precondition', true);
|
|
1073
|
+
if (isRuntimeGuard(guard))
|
|
1074
|
+
return normalizeRuntimeGuard(guard, 'precondition', true);
|
|
1075
|
+
if (isTradeBuyGuard(guard) || isTradeSellGuard(guard)) {
|
|
1076
|
+
const keys = isTradeBuyGuard(guard)
|
|
1077
|
+
? ['floorRaw']
|
|
1078
|
+
: ['atlasOutCapPerEpochRaw', 'epochLengthSeconds'];
|
|
1079
|
+
const decoded = { ...guard };
|
|
1080
|
+
for (const key of keys) {
|
|
1081
|
+
const raw = guard[key];
|
|
1082
|
+
const pattern = key === 'epochLengthSeconds'
|
|
1083
|
+
? /^(0|[1-9][0-9]*|-[1-9][0-9]*)$/
|
|
1084
|
+
: /^(0|[1-9][0-9]*)$/;
|
|
1085
|
+
if (typeof raw !== 'string' || !pattern.test(raw))
|
|
1086
|
+
invalid(key, raw, 'a canonical decimal string');
|
|
1087
|
+
decoded[key] = BigInt(raw);
|
|
1088
|
+
}
|
|
1089
|
+
return decoded;
|
|
1090
|
+
}
|
|
1091
|
+
if (guard.kind === 'fleet-add-ship') {
|
|
1092
|
+
for (const field of ['amount', 'maximumProfileDebit'])
|
|
1093
|
+
if (typeof guard[field] !== 'string' ||
|
|
1094
|
+
!/^(0|[1-9][0-9]*)$/.test(guard[field]))
|
|
1095
|
+
invalid(field, guard[field], 'a canonical unsigned decimal string');
|
|
1096
|
+
return {
|
|
1097
|
+
...guard,
|
|
1098
|
+
amount: BigInt(guard.amount),
|
|
1099
|
+
maximumProfileDebit: BigInt(guard.maximumProfileDebit),
|
|
1100
|
+
};
|
|
1101
|
+
}
|
|
1102
|
+
if (guard.kind === 'character-registration') {
|
|
1103
|
+
for (const key of ['characterLamports', 'budgetLamports'])
|
|
1104
|
+
if (typeof guard[key] !== 'string' ||
|
|
1105
|
+
!/^(0|[1-9][0-9]*)$/.test(guard[key]))
|
|
1106
|
+
invalid(key, guard[key], 'a canonical unsigned decimal string');
|
|
1107
|
+
if (typeof guard.maximumFunderDebit !== 'string' ||
|
|
1108
|
+
!/^(0|[1-9][0-9]*)$/.test(guard.maximumFunderDebit))
|
|
1109
|
+
invalid('maximumFunderDebit', guard.maximumFunderDebit, 'a canonical unsigned decimal string');
|
|
1110
|
+
return {
|
|
1111
|
+
...guard,
|
|
1112
|
+
maximumFunderDebit: BigInt(guard.maximumFunderDebit),
|
|
1113
|
+
characterLamports: BigInt(guard.characterLamports),
|
|
1114
|
+
budgetLamports: BigInt(guard.budgetLamports),
|
|
1115
|
+
};
|
|
1116
|
+
}
|
|
1117
|
+
if (guard.kind === 'fleet-crew-transfer') {
|
|
1118
|
+
if (typeof guard.systemSequenceId !== 'string' ||
|
|
1119
|
+
!/^(0|[1-9][0-9]*)$/.test(guard.systemSequenceId))
|
|
1120
|
+
invalid('systemSequenceId', guard.systemSequenceId, 'a canonical unsigned decimal string');
|
|
1121
|
+
return { ...guard, systemSequenceId: BigInt(guard.systemSequenceId) };
|
|
1122
|
+
}
|
|
1123
|
+
if (guard.kind === 'fleet-respawn') {
|
|
1124
|
+
for (const key of ['maximumRecoveryFee', 'maximumProfileDebit'])
|
|
1125
|
+
if (typeof guard[key] !== 'string' ||
|
|
1126
|
+
!/^(0|[1-9][0-9]*)$/.test(guard[key]))
|
|
1127
|
+
invalid(key, guard[key], 'a canonical unsigned decimal string');
|
|
1128
|
+
return {
|
|
1129
|
+
...guard,
|
|
1130
|
+
maximumRecoveryFee: BigInt(guard.maximumRecoveryFee),
|
|
1131
|
+
maximumProfileDebit: BigInt(guard.maximumProfileDebit),
|
|
1132
|
+
};
|
|
1133
|
+
}
|
|
1134
|
+
if (guard.kind === 'scan-signal-open' ||
|
|
1135
|
+
guard.kind === 'fleet-create' ||
|
|
1136
|
+
guard.kind === 'ship-import-funding') {
|
|
1137
|
+
if (typeof guard.maximumProfileDebit !== 'string' ||
|
|
1138
|
+
!/^(0|[1-9][0-9]*)$/.test(guard.maximumProfileDebit))
|
|
1139
|
+
invalid('maximumProfileDebit', guard.maximumProfileDebit, 'a canonical unsigned decimal string');
|
|
1140
|
+
return {
|
|
1141
|
+
...guard,
|
|
1142
|
+
maximumProfileDebit: BigInt(guard.maximumProfileDebit),
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
if (guard.kind === 'starbase-system') {
|
|
1146
|
+
if (typeof guard.starbaseSequenceId !== 'string' ||
|
|
1147
|
+
!/^(0|[1-9][0-9]*)$/.test(guard.starbaseSequenceId))
|
|
1148
|
+
invalid('starbaseSequenceId', guard.starbaseSequenceId, 'a canonical unsigned decimal string');
|
|
1149
|
+
return { ...guard, starbaseSequenceId: BigInt(guard.starbaseSequenceId) };
|
|
1150
|
+
}
|
|
1151
|
+
if (guard.kind !== 'token-account')
|
|
1152
|
+
return guard;
|
|
1153
|
+
if (typeof guard.minimumBalance !== 'string' ||
|
|
1154
|
+
!/^(0|[1-9][0-9]*)$/.test(guard.minimumBalance))
|
|
1155
|
+
invalid('minimumBalance', guard.minimumBalance, 'a canonical unsigned decimal string');
|
|
1156
|
+
return { ...guard, minimumBalance: BigInt(guard.minimumBalance) };
|
|
1157
|
+
});
|
|
512
1158
|
const steps = readArray(value.steps, 'planJson.steps').map((candidate, index) => {
|
|
513
1159
|
const field = `planJson.steps[${String(index)}]`;
|
|
514
1160
|
const step = readRecord(candidate, field);
|
|
515
|
-
assertKeys(step, field, ['instruction', 'describes', 'signers'],
|
|
1161
|
+
assertKeys(step, field, ['instruction', 'describes', 'signers'], ['semantics']);
|
|
516
1162
|
return {
|
|
517
1163
|
instruction: readWireInstruction(step.instruction, `${field}.instruction`),
|
|
518
1164
|
describes: readString(step.describes, `${field}.describes`),
|
|
519
|
-
...(
|
|
1165
|
+
...(step.semantics !== undefined
|
|
520
1166
|
? {
|
|
521
1167
|
semantics: readArray(step.semantics, `${field}.semantics`).map((semantic, semanticIndex) => normalizeSemanticFact(semantic, `${field}.semantics[${String(semanticIndex)}]`)),
|
|
522
1168
|
}
|
|
@@ -524,7 +1170,7 @@ export function planFromJSON(json) {
|
|
|
524
1170
|
signers: readArray(step.signers, `${field}.signers`).map((signer, signerIndex) => readAddress(signer, `${field}.signers[${String(signerIndex)}]`)),
|
|
525
1171
|
};
|
|
526
1172
|
});
|
|
527
|
-
const preconditions = readArray(value.preconditions, 'planJson.preconditions').map((candidate, index) => normalizePrecondition(candidate, `planJson.preconditions[${String(index)}]
|
|
1173
|
+
const preconditions = readArray(value.preconditions, 'planJson.preconditions').map((candidate, index) => normalizePrecondition(candidate, `planJson.preconditions[${String(index)}]`));
|
|
528
1174
|
const affected = readArray(value.affected, 'planJson.affected').map((candidate, index) => readAddress(candidate, `planJson.affected[${String(index)}]`));
|
|
529
1175
|
const requiredSigners = readArray(value.requiredSigners, 'planJson.requiredSigners').map((candidate, index) => readAddress(candidate, `planJson.requiredSigners[${String(index)}]`));
|
|
530
1176
|
const plan = createPlan({
|
|
@@ -533,6 +1179,10 @@ export function planFromJSON(json) {
|
|
|
533
1179
|
steps,
|
|
534
1180
|
preconditions,
|
|
535
1181
|
});
|
|
1182
|
+
validateStarbaseSystemInstructions(plan.steps, plan.preconditions);
|
|
1183
|
+
validateMovementXpInstructions(plan.steps, plan.preconditions);
|
|
1184
|
+
validateFleetAttackInstructions(plan.steps, plan.preconditions);
|
|
1185
|
+
validateCharacterRegistrationInstructions(plan.steps, plan.preconditions);
|
|
536
1186
|
if (!sameAddresses(plan.affected, affected)) {
|
|
537
1187
|
invalid('planJson.affected', value.affected, 'the first-seen union of writable instruction account addresses');
|
|
538
1188
|
}
|
|
@@ -549,6 +1199,49 @@ function assertPlan(value, index) {
|
|
|
549
1199
|
function combinedSummary(steps) {
|
|
550
1200
|
return steps.map((step) => step.describes).join(' ');
|
|
551
1201
|
}
|
|
1202
|
+
function validateShipImportFundingComposition(guards) {
|
|
1203
|
+
const targets = new Map();
|
|
1204
|
+
for (const guard of guards) {
|
|
1205
|
+
if (guard.kind !== 'ship-import-funding')
|
|
1206
|
+
continue;
|
|
1207
|
+
const identity = `${guard.game}:${guard.profile}:${guard.system}:${String(guard.shipId)}`;
|
|
1208
|
+
const previous = targets.get(guard.address);
|
|
1209
|
+
if (previous !== undefined && previous !== identity)
|
|
1210
|
+
throw new SageSdkError('INCOMPATIBLE_PLAN_COMPOSITION', 'Ship imports retain conflicting identities or different configurations for one StarbasePlayer. Use separate confirmed imports, then refresh inventory and replan; prefunding cannot be shared across independently estimated storage growth.');
|
|
1211
|
+
targets.set(guard.address, identity);
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
function validateFactionGuardComposition(guards) {
|
|
1215
|
+
const retained = new Map();
|
|
1216
|
+
for (const guard of guards) {
|
|
1217
|
+
if (!isFactionTradeGuard(guard))
|
|
1218
|
+
continue;
|
|
1219
|
+
const constraints = [
|
|
1220
|
+
[
|
|
1221
|
+
`${isTradeMeterGuard(guard) ? 'meter' : 'treasury'}:${guard.address}:identity`,
|
|
1222
|
+
`${guard.game}:${String(guard.factionId)}`,
|
|
1223
|
+
],
|
|
1224
|
+
];
|
|
1225
|
+
if (!isTradeMeterGuard(guard)) {
|
|
1226
|
+
constraints.push(isTradeBuyGuard(guard)
|
|
1227
|
+
? [
|
|
1228
|
+
`${guard.address}:buy:${String(guard.cargoId)}`,
|
|
1229
|
+
String(guard.floorRaw),
|
|
1230
|
+
]
|
|
1231
|
+
: [
|
|
1232
|
+
`${guard.address}:sell`,
|
|
1233
|
+
`${String(guard.atlasOutCapPerEpochRaw)}:${String(guard.epochLengthSeconds)}`,
|
|
1234
|
+
]);
|
|
1235
|
+
}
|
|
1236
|
+
constraints.push([`${guard.address}:schema`, String(guard.schemaVersion)]);
|
|
1237
|
+
for (const [key, value] of constraints) {
|
|
1238
|
+
const previous = retained.get(key);
|
|
1239
|
+
if (previous !== undefined && previous !== value)
|
|
1240
|
+
throw new SageSdkError('INCOMPATIBLE_PLAN_COMPOSITION', 'Faction Market Plans retain incompatible Treasury policy or shared account identity. Refresh the affected Markets and prepare compatible Plans, or use separate confirmed transactions.');
|
|
1241
|
+
retained.set(key, value);
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
552
1245
|
/** Combines one or more Plans with deterministic associative flattening.
|
|
553
1246
|
*
|
|
554
1247
|
* Semantic validation is eager. Conflict indices are relative to the flattened
|
|
@@ -569,11 +1262,25 @@ export function combinePlans(...plans) {
|
|
|
569
1262
|
plans.forEach(assertPlan);
|
|
570
1263
|
const steps = plans.flatMap((plan) => plan.steps);
|
|
571
1264
|
validatePlanComposition(steps);
|
|
1265
|
+
const preconditions = plans.flatMap((plan) => plan.preconditions);
|
|
1266
|
+
validateFactionGuardComposition(preconditions);
|
|
1267
|
+
validateMiningStopInstructions(steps, preconditions);
|
|
1268
|
+
validateStarbaseSystemInstructions(steps, preconditions);
|
|
1269
|
+
validateCharacterRegistrationInstructions(steps, preconditions);
|
|
1270
|
+
validateArrivalInstructions(steps, preconditions);
|
|
1271
|
+
validateDetectInstructions(steps, preconditions);
|
|
1272
|
+
validateCompletionInstructions(steps, preconditions);
|
|
1273
|
+
validateRespawnInstructions(steps, preconditions);
|
|
1274
|
+
validateCrewTransferInstructions(steps, preconditions);
|
|
1275
|
+
validateOpenSignalInstructions(steps, preconditions);
|
|
1276
|
+
validateRuntimeInstructions(steps, preconditions);
|
|
1277
|
+
validateMovementXpInstructions(steps, preconditions);
|
|
1278
|
+
validateFleetAttackInstructions(steps, preconditions);
|
|
572
1279
|
return createPlan({
|
|
573
1280
|
kind: 'combined',
|
|
574
1281
|
summary: combinedSummary(steps),
|
|
575
1282
|
steps,
|
|
576
|
-
preconditions
|
|
1283
|
+
preconditions,
|
|
577
1284
|
});
|
|
578
1285
|
}
|
|
579
1286
|
export { assemblePlan } from './assembly.js';
|