@aephia/atlas-kit 0.6.0-next.7 → 0.6.0-next.70
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 +87 -37
- package/dist/claim-stakes/actions/index.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 +4 -0
- 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.map +1 -1
- package/dist/crafting/actions/index.js +49 -29
- package/dist/crafting/actions/index.js.map +1 -1
- package/dist/crafting/index.d.ts +24 -2
- package/dist/crafting/index.d.ts.map +1 -1
- package/dist/crafting/index.js +31 -2
- 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 +1 -1
- 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 +34 -15
- package/dist/fleets/actions/index.d.ts.map +1 -1
- package/dist/fleets/actions/index.js +168 -109
- 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 +48 -0
- package/dist/fleets/actions/ship-import.d.ts.map +1 -0
- package/dist/fleets/actions/ship-import.js +330 -0
- package/dist/fleets/actions/ship-import.js.map +1 -0
- 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 +3 -0
- package/dist/fleets/index.d.ts.map +1 -1
- package/dist/fleets/index.js +3 -0
- 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/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 +23 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -1
- 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 +0 -27
- package/dist/internal/c4/claim-stake.d.ts.map +1 -1
- package/dist/internal/c4/claim-stake.js +0 -33
- 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 +43 -19
- package/dist/internal/c4/fleet.d.ts.map +1 -1
- package/dist/internal/c4/fleet.js +1 -0
- package/dist/internal/c4/fleet.js.map +1 -1
- package/dist/internal/c4/game.d.ts +31 -8
- package/dist/internal/c4/game.d.ts.map +1 -1
- package/dist/internal/c4/game.js +88 -12
- 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 +1 -37
- package/dist/internal/c4/market.d.ts.map +1 -1
- package/dist/internal/c4/market.js +11 -49
- 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 +12 -2
- package/dist/internal/c4/world.d.ts.map +1 -1
- package/dist/internal/c4/world.js +28 -6
- 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 +19 -6
- package/dist/internal/planning/authorization-adapter.d.ts.map +1 -1
- package/dist/internal/planning/authorization-adapter.js +102 -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-enrollment.js +2 -2
- package/dist/internal/planning/faction-enrollment.js.map +1 -1
- 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 +106 -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 +220 -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/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 +10 -0
- package/dist/internal/planning/ship-token.d.ts.map +1 -0
- package/dist/internal/planning/ship-token.js +47 -0
- package/dist/internal/planning/ship-token.js.map +1 -0
- 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 +1 -0
- package/dist/markets/actions/index.d.ts.map +1 -1
- package/dist/markets/actions/index.js +40 -16
- 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/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 +378 -12
- package/dist/planning/execution.js.map +1 -1
- package/dist/planning/index.d.ts +180 -132
- package/dist/planning/index.d.ts.map +1 -1
- package/dist/planning/index.js +845 -104
- package/dist/planning/index.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 +30 -0
- package/dist/registry/ships.d.ts.map +1 -0
- package/dist/registry/ships.js +59 -0
- package/dist/registry/ships.js.map +1 -0
- 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 +209 -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 +5 -2
- 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 +64 -5
- package/dist/world/index.d.ts.map +1 -1
- package/dist/world/index.js +53 -4
- package/dist/world/index.js.map +1 -1
- package/package.json +10 -2
|
@@ -0,0 +1,636 @@
|
|
|
1
|
+
import { AccountRole, isAddress, } from '@solana/kit';
|
|
2
|
+
import { InvalidActionInputError, SageSdkError } from '../../client/errors.js';
|
|
3
|
+
import { deepFreeze } from '../immutable-tree.js';
|
|
4
|
+
import { ATTACK_STARBASE_DISCRIMINATOR, PLACE_CLAIM_STAKE_BUILDINGS_DISCRIMINATOR, CANCEL_CLAIM_STAKE_BUILDING_DESIGN_DISCRIMINATOR, FINALIZE_BUILDING_CHANGES_DISCRIMINATOR, START_CLAIM_STAKES_FLEET_TRANSFER_DISCRIMINATOR, getPlaceClaimStakeBuildingsInstructionDataDecoder, getCancelClaimStakeBuildingDesignInstructionDataDecoder, getFinalizeBuildingChangesInstructionDataDecoder, getStartClaimStakesFleetTransferInstructionDataDecoder, CANCEL_LOCAL_MARKET_ORDERS_DISCRIMINATOR, COMPLETE_CRAFTING_PROCESS_DISCRIMINATOR, PLACE_LOCAL_MARKET_ORDER_DISCRIMINATOR, SAGE_PROGRAM_ADDRESS, START_CRAFTING_PROCESS_DISCRIMINATOR, getAttackStarbaseInstructionDataDecoder, getCancelLocalMarketOrdersInstructionDataDecoder, getCompleteCraftingProcessInstructionDataDecoder, getPlaceLocalMarketOrderInstructionDataDecoder, getStartCraftingProcessInstructionDataDecoder, } from '../c4/runtime-bindings.js';
|
|
5
|
+
import { resolveDemocracyHistory, matchDemocracyHistoryIntent, } from './democracy-history.js';
|
|
6
|
+
import { resolveXpRuntime, } from './xp-runtime.js';
|
|
7
|
+
import { resolveGovernanceFees, matchGovernanceFeesIntent, } from './governance-fees.js';
|
|
8
|
+
export function isRuntimeGuard(value) {
|
|
9
|
+
return (value.kind === 'democracy-history' ||
|
|
10
|
+
value.kind === 'xp-runtime' ||
|
|
11
|
+
value.kind === 'governance-fees');
|
|
12
|
+
}
|
|
13
|
+
function invalid(field, value) {
|
|
14
|
+
throw new InvalidActionInputError(field, value, 'the exact supported runtime safeguard fields and values', 'Recreate the Plan from fresh gameplay state with this SDK version.');
|
|
15
|
+
}
|
|
16
|
+
function record(value, field, required, optional = []) {
|
|
17
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
18
|
+
invalid(field, value);
|
|
19
|
+
const result = value;
|
|
20
|
+
if (required.some((key) => !Object.hasOwn(result, key)) ||
|
|
21
|
+
Object.keys(result).some((key) => !required.includes(key) && !optional.includes(key)))
|
|
22
|
+
invalid(field, value);
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
function address(value, field) {
|
|
26
|
+
if (typeof value !== 'string' || !isAddress(value))
|
|
27
|
+
invalid(field, value);
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
function integer(value, field, maximum) {
|
|
31
|
+
if (typeof value !== 'number' ||
|
|
32
|
+
!Number.isInteger(value) ||
|
|
33
|
+
value < 0 ||
|
|
34
|
+
value > maximum)
|
|
35
|
+
invalid(field, value);
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
function token(value, field, choices) {
|
|
39
|
+
if (typeof value !== 'string' || !choices.includes(value))
|
|
40
|
+
invalid(field, value);
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
function big(value, field, wire) {
|
|
44
|
+
if (wire) {
|
|
45
|
+
if (typeof value !== 'string' || !/^(0|[1-9][0-9]*)$/.test(value))
|
|
46
|
+
invalid(field, value);
|
|
47
|
+
value = BigInt(value);
|
|
48
|
+
}
|
|
49
|
+
if (typeof value !== 'bigint' || value < 0n || value > (1n << 64n) - 1n)
|
|
50
|
+
invalid(field, value);
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
function feeParams(value, field) {
|
|
54
|
+
const keys = [
|
|
55
|
+
'craftingFeeBps',
|
|
56
|
+
'localMarketFeeBps',
|
|
57
|
+
'localTreasuryShareBps',
|
|
58
|
+
'treasuryDistributionBps',
|
|
59
|
+
];
|
|
60
|
+
const row = record(value, field, keys);
|
|
61
|
+
return Object.fromEntries(keys.map((key) => [key, integer(row[key], `${field}.${key}`, 65535)]));
|
|
62
|
+
}
|
|
63
|
+
function historyIntent(value, field, wire) {
|
|
64
|
+
const state = value?.state;
|
|
65
|
+
const row = record(value, field, [
|
|
66
|
+
'game',
|
|
67
|
+
'system',
|
|
68
|
+
'address',
|
|
69
|
+
'state',
|
|
70
|
+
...(state === 'initialized'
|
|
71
|
+
? [
|
|
72
|
+
'openDay',
|
|
73
|
+
'enabled',
|
|
74
|
+
'controller',
|
|
75
|
+
'generationNumber',
|
|
76
|
+
'governance',
|
|
77
|
+
'starbaseSeqId',
|
|
78
|
+
'policy',
|
|
79
|
+
'policyFlags',
|
|
80
|
+
'effectiveParams',
|
|
81
|
+
]
|
|
82
|
+
: []),
|
|
83
|
+
], state === 'initialized' ? ['generation'] : []);
|
|
84
|
+
const scope = {
|
|
85
|
+
game: address(row.game, field),
|
|
86
|
+
system: address(row.system, field),
|
|
87
|
+
address: address(row.address, field),
|
|
88
|
+
};
|
|
89
|
+
if (token(row.state, field, ['absent', 'initialized']) === 'absent')
|
|
90
|
+
return { ...scope, state: 'absent' };
|
|
91
|
+
const flagKeys = [
|
|
92
|
+
'noControllerRevenue',
|
|
93
|
+
'zeroPowerRevenue',
|
|
94
|
+
'successorBaseline',
|
|
95
|
+
'captureIncomingEligibility',
|
|
96
|
+
];
|
|
97
|
+
const flags = record(row.policyFlags, `${field}.policyFlags`, flagKeys);
|
|
98
|
+
const policyFlags = Object.fromEntries(flagKeys.map((key) => {
|
|
99
|
+
const n = integer(flags[key], `${field}.policyFlags.${key}`, 2);
|
|
100
|
+
if (n === 0)
|
|
101
|
+
invalid(field, n);
|
|
102
|
+
return [key, n];
|
|
103
|
+
}));
|
|
104
|
+
return {
|
|
105
|
+
...scope,
|
|
106
|
+
state: 'initialized',
|
|
107
|
+
openDay: big(row.openDay, field, wire),
|
|
108
|
+
enabled: integer(row.enabled, field, 1),
|
|
109
|
+
controller: integer(row.controller, field, 65535),
|
|
110
|
+
generationNumber: big(row.generationNumber, field, wire),
|
|
111
|
+
governance: address(row.governance, field),
|
|
112
|
+
starbaseSeqId: big(row.starbaseSeqId, field, wire),
|
|
113
|
+
policy: address(row.policy, field),
|
|
114
|
+
policyFlags,
|
|
115
|
+
effectiveParams: feeParams(row.effectiveParams, field),
|
|
116
|
+
...(row.generation === undefined
|
|
117
|
+
? {}
|
|
118
|
+
: { generation: address(row.generation, field) }),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function xpIntent(value, field) {
|
|
122
|
+
const row = record(value, field, ['game', 'gameVersion'], ['character', 'structure', 'profile']);
|
|
123
|
+
if (row.gameVersion !== 2)
|
|
124
|
+
invalid(field, row.gameVersion);
|
|
125
|
+
if (row.profile !== undefined && row.character === undefined)
|
|
126
|
+
invalid(field, row.profile);
|
|
127
|
+
return {
|
|
128
|
+
game: address(row.game, field),
|
|
129
|
+
gameVersion: row.gameVersion,
|
|
130
|
+
...(row.profile === undefined
|
|
131
|
+
? {}
|
|
132
|
+
: { profile: address(row.profile, field) }),
|
|
133
|
+
...(row.character === undefined
|
|
134
|
+
? {}
|
|
135
|
+
: { character: address(row.character, field) }),
|
|
136
|
+
...(row.structure === undefined
|
|
137
|
+
? {}
|
|
138
|
+
: { structure: address(row.structure, field) }),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function accountAddresses(value, field, required, optional) {
|
|
142
|
+
const row = record(value, field, required, optional);
|
|
143
|
+
return Object.fromEntries(Object.entries(row).map(([key, value]) => [
|
|
144
|
+
key,
|
|
145
|
+
address(value, `${field}.${key}`),
|
|
146
|
+
]));
|
|
147
|
+
}
|
|
148
|
+
/** Strict nested runtime parsing applies both to factory values and persisted JSON. */
|
|
149
|
+
export function normalizeRuntimeGuard(value, field, wire = false) {
|
|
150
|
+
const row = record(value, field, [
|
|
151
|
+
'kind',
|
|
152
|
+
'address',
|
|
153
|
+
'intent',
|
|
154
|
+
'accounts',
|
|
155
|
+
'describes',
|
|
156
|
+
]);
|
|
157
|
+
const kind = token(row.kind, field, [
|
|
158
|
+
'democracy-history',
|
|
159
|
+
'xp-runtime',
|
|
160
|
+
'governance-fees',
|
|
161
|
+
]);
|
|
162
|
+
const at = address(row.address, `${field}.address`);
|
|
163
|
+
if (typeof row.describes !== 'string')
|
|
164
|
+
invalid(field, row.describes);
|
|
165
|
+
const base = { address: at, describes: row.describes };
|
|
166
|
+
if (kind === 'democracy-history') {
|
|
167
|
+
const intent = historyIntent(row.intent, `${field}.intent`, wire);
|
|
168
|
+
const accounts = accountAddresses(row.accounts, field, ['democracyHistoryHistory'], ['democracyHistoryPolicy', 'democracyHistoryGeneration']);
|
|
169
|
+
if (at !== intent.address ||
|
|
170
|
+
accounts.democracyHistoryHistory !== at ||
|
|
171
|
+
accounts.democracyHistoryPolicy !==
|
|
172
|
+
(intent.state === 'initialized' ? intent.policy : undefined) ||
|
|
173
|
+
accounts.democracyHistoryGeneration !==
|
|
174
|
+
(intent.state === 'initialized' ? intent.generation : undefined))
|
|
175
|
+
invalid(field, value);
|
|
176
|
+
return deepFreeze({ ...base, kind, intent, accounts });
|
|
177
|
+
}
|
|
178
|
+
if (kind === 'xp-runtime') {
|
|
179
|
+
const intent = xpIntent(row.intent, `${field}.intent`);
|
|
180
|
+
const accounts = accountAddresses(row.accounts, field, [], ['xpBudget', 'xpBudgetConfig', 'xpAccrual']);
|
|
181
|
+
if (at !== intent.game ||
|
|
182
|
+
Boolean(accounts.xpBudgetConfig) !== Boolean(intent.character) ||
|
|
183
|
+
Boolean(accounts.xpBudget) !== Boolean(intent.character) ||
|
|
184
|
+
Boolean(accounts.xpAccrual) !== Boolean(intent.structure))
|
|
185
|
+
invalid(field, value);
|
|
186
|
+
return deepFreeze({ ...base, kind, intent, accounts });
|
|
187
|
+
}
|
|
188
|
+
return normalizeFeeGuard(row, base, field, wire);
|
|
189
|
+
}
|
|
190
|
+
/** Bigints use canonical decimal strings; schema validation excludes arbitrary object graphs. */
|
|
191
|
+
export function runtimeGuardToJSON(guard) {
|
|
192
|
+
return JSON.parse(JSON.stringify(guard, (_key, value) => typeof value === 'bigint' ? value.toString() : value));
|
|
193
|
+
}
|
|
194
|
+
function sameAccounts(a, b) {
|
|
195
|
+
const left = Object.entries(a);
|
|
196
|
+
return (left.length === Object.keys(b).length &&
|
|
197
|
+
left.every(([key, value]) => b[key] === value));
|
|
198
|
+
}
|
|
199
|
+
function changed(guard) {
|
|
200
|
+
const cause = guard
|
|
201
|
+
? `The ${guard.kind} safeguard at ${guard.address} no longer matches current eligibility or account bindings: ${guard.describes}`
|
|
202
|
+
: 'This instruction has an unsupported layout or lacks matching XP, Democracy-history or fee safeguards, including account addresses and roles.';
|
|
203
|
+
throw new SageSdkError('ACTION_PRECONDITION_FAILED', `${cause} Refresh the affected gameplay state and recreate this Plan before signing.`);
|
|
204
|
+
}
|
|
205
|
+
/** Resolve canonical accounts again; shared balances and XP counters are not compared. */
|
|
206
|
+
export async function revalidateRuntimeGuards(ctx, guards, freshGameVersions = new Map()) {
|
|
207
|
+
const histories = new Map();
|
|
208
|
+
const history = async (scope) => {
|
|
209
|
+
const key = `${scope.game}:${scope.system}`;
|
|
210
|
+
let resolved = histories.get(key);
|
|
211
|
+
if (!resolved) {
|
|
212
|
+
resolved = await resolveDemocracyHistory(ctx, scope);
|
|
213
|
+
histories.set(key, resolved);
|
|
214
|
+
}
|
|
215
|
+
return resolved;
|
|
216
|
+
};
|
|
217
|
+
for (const guard of guards) {
|
|
218
|
+
if (guard.kind === 'democracy-history') {
|
|
219
|
+
const current = await history(guard.intent);
|
|
220
|
+
if (!matchDemocracyHistoryIntent(guard.intent, current.intent) ||
|
|
221
|
+
!sameAccounts(guard.accounts, current.accounts))
|
|
222
|
+
changed(guard);
|
|
223
|
+
}
|
|
224
|
+
else if (guard.kind === 'xp-runtime') {
|
|
225
|
+
const current = await resolveXpRuntime(ctx, guard.intent, freshGameVersions);
|
|
226
|
+
if (!sameAccounts(guard.intent, current.intent) ||
|
|
227
|
+
!sameAccounts(guard.accounts, current.accounts))
|
|
228
|
+
changed(guard);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
const current = await resolveGovernanceFees(ctx, guard.intent.request, await history(guard.intent.request));
|
|
232
|
+
if (!matchGovernanceFeesIntent(guard.intent, current.intent) ||
|
|
233
|
+
!sameAccounts(guard.accounts, current.accounts))
|
|
234
|
+
changed(guard);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
function feeQuoteParams(value, field) {
|
|
239
|
+
const row = record(value, field, ['craftingFeeBps', 'localMarketFeeBps', 'localTreasuryShareBps'], ['treasuryDistributionBps']);
|
|
240
|
+
return {
|
|
241
|
+
craftingFeeBps: integer(row.craftingFeeBps, field, 65535),
|
|
242
|
+
localMarketFeeBps: integer(row.localMarketFeeBps, field, 65535),
|
|
243
|
+
localTreasuryShareBps: integer(row.localTreasuryShareBps, field, 65535),
|
|
244
|
+
...(row.treasuryDistributionBps === undefined
|
|
245
|
+
? {}
|
|
246
|
+
: {
|
|
247
|
+
treasuryDistributionBps: integer(row.treasuryDistributionBps, field, 65535),
|
|
248
|
+
}),
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
function normalizeFeeGuard(row, base, field, wire) {
|
|
252
|
+
const source = record(row.intent, `${field}.intent`, ['request', 'quote'], ['governance', 'currencyCache', 'treasury', 'process']);
|
|
253
|
+
const request = record(source.request, field, ['game', 'system', 'starbaseSeqId', 'mode'], ['hasHab', 'process']);
|
|
254
|
+
const mode = token(request.mode, field, [
|
|
255
|
+
'market',
|
|
256
|
+
'crafting-start',
|
|
257
|
+
'crafting-complete',
|
|
258
|
+
]);
|
|
259
|
+
if (request.hasHab !== undefined && typeof request.hasHab !== 'boolean')
|
|
260
|
+
invalid(field, request.hasHab);
|
|
261
|
+
const normalizedRequest = {
|
|
262
|
+
game: address(request.game, field),
|
|
263
|
+
system: address(request.system, field),
|
|
264
|
+
starbaseSeqId: big(request.starbaseSeqId, field, wire),
|
|
265
|
+
mode,
|
|
266
|
+
...(request.hasHab === undefined
|
|
267
|
+
? {}
|
|
268
|
+
: { hasHab: request.hasHab }),
|
|
269
|
+
...(request.process === undefined
|
|
270
|
+
? {}
|
|
271
|
+
: { process: address(request.process, field) }),
|
|
272
|
+
};
|
|
273
|
+
if (base.address !== normalizedRequest.game ||
|
|
274
|
+
(mode === 'crafting-complete') !== (request.process !== undefined) ||
|
|
275
|
+
(mode === 'market' && request.hasHab !== undefined))
|
|
276
|
+
invalid(field, request);
|
|
277
|
+
let governance;
|
|
278
|
+
if (source.governance !== undefined) {
|
|
279
|
+
const state = token(source.governance?.state, field, ['absent', 'initialized']);
|
|
280
|
+
const g = record(source.governance, field, [
|
|
281
|
+
'address',
|
|
282
|
+
'state',
|
|
283
|
+
...(state === 'initialized'
|
|
284
|
+
? ['version', 'enabled', 'controllerFaction', 'starbaseSeqId']
|
|
285
|
+
: []),
|
|
286
|
+
], state === 'initialized' ? ['activeParams'] : []);
|
|
287
|
+
if (state === 'initialized' && g.version !== 2 && g.version !== 3)
|
|
288
|
+
invalid(field, g.version);
|
|
289
|
+
governance = {
|
|
290
|
+
address: address(g.address, field),
|
|
291
|
+
state,
|
|
292
|
+
...(state === 'absent'
|
|
293
|
+
? {}
|
|
294
|
+
: {
|
|
295
|
+
version: integer(g.version, field, 255),
|
|
296
|
+
enabled: integer(g.enabled, field, 1),
|
|
297
|
+
controllerFaction: integer(g.controllerFaction, field, 65535),
|
|
298
|
+
starbaseSeqId: big(g.starbaseSeqId, field, wire),
|
|
299
|
+
...(g.activeParams === undefined
|
|
300
|
+
? {}
|
|
301
|
+
: { activeParams: feeQuoteParams(g.activeParams, field) }),
|
|
302
|
+
}),
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
let currencyCache;
|
|
306
|
+
if (source.currencyCache !== undefined) {
|
|
307
|
+
const c = record(source.currencyCache, field, ['address', 'version']);
|
|
308
|
+
currencyCache = {
|
|
309
|
+
address: address(c.address, field),
|
|
310
|
+
version: integer(c.version, field, 255),
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
let treasury;
|
|
314
|
+
if (source.treasury !== undefined) {
|
|
315
|
+
const state = token(source.treasury?.state, field, ['absent', 'initialized']);
|
|
316
|
+
const t = record(source.treasury, field, [
|
|
317
|
+
'address',
|
|
318
|
+
'state',
|
|
319
|
+
...(state === 'initialized' ? ['version', 'governance'] : []),
|
|
320
|
+
]);
|
|
321
|
+
treasury = {
|
|
322
|
+
address: address(t.address, field),
|
|
323
|
+
state,
|
|
324
|
+
...(state === 'absent'
|
|
325
|
+
? {}
|
|
326
|
+
: {
|
|
327
|
+
version: integer(t.version, field, 255),
|
|
328
|
+
governance: address(t.governance, field),
|
|
329
|
+
}),
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
let process;
|
|
333
|
+
if (source.process !== undefined) {
|
|
334
|
+
const p = record(source.process, field, ['address', 'version'], ['feeRecipient', 'feeGovernance', 'feeSnapshot']);
|
|
335
|
+
const version = integer(p.version, field, 1);
|
|
336
|
+
if (version === 0 &&
|
|
337
|
+
(p.feeRecipient !== undefined ||
|
|
338
|
+
p.feeGovernance !== undefined ||
|
|
339
|
+
p.feeSnapshot !== undefined))
|
|
340
|
+
invalid(field, p);
|
|
341
|
+
if (version === 1 &&
|
|
342
|
+
(p.feeRecipient === undefined || p.feeSnapshot === undefined))
|
|
343
|
+
invalid(field, p);
|
|
344
|
+
const s = p.feeSnapshot === undefined
|
|
345
|
+
? undefined
|
|
346
|
+
: record(p.feeSnapshot, field, [
|
|
347
|
+
'craftingFeeBasisPoints',
|
|
348
|
+
'localMarketFeeBasisPoints',
|
|
349
|
+
'localTreasuryShareBasisPoints',
|
|
350
|
+
]);
|
|
351
|
+
process = {
|
|
352
|
+
address: address(p.address, field),
|
|
353
|
+
version,
|
|
354
|
+
...(p.feeRecipient === undefined
|
|
355
|
+
? {}
|
|
356
|
+
: {
|
|
357
|
+
feeRecipient: token(p.feeRecipient, field, ['atlas', 'dao-atlas']),
|
|
358
|
+
}),
|
|
359
|
+
...(p.feeGovernance === undefined
|
|
360
|
+
? {}
|
|
361
|
+
: { feeGovernance: address(p.feeGovernance, field) }),
|
|
362
|
+
...(s
|
|
363
|
+
? {
|
|
364
|
+
feeSnapshot: {
|
|
365
|
+
craftingFeeBasisPoints: integer(s.craftingFeeBasisPoints, field, 65535),
|
|
366
|
+
localMarketFeeBasisPoints: integer(s.localMarketFeeBasisPoints, field, 65535),
|
|
367
|
+
localTreasuryShareBasisPoints: integer(s.localTreasuryShareBasisPoints, field, 65535),
|
|
368
|
+
},
|
|
369
|
+
}
|
|
370
|
+
: {}),
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
const q = record(source.quote, field, ['source'], ['params']);
|
|
374
|
+
const quoteSource = token(q.source, field, [
|
|
375
|
+
'default',
|
|
376
|
+
'governance',
|
|
377
|
+
'history-policy',
|
|
378
|
+
'history-generation',
|
|
379
|
+
'history-disabled',
|
|
380
|
+
'process-snapshot',
|
|
381
|
+
'legacy-process',
|
|
382
|
+
]);
|
|
383
|
+
if ((quoteSource === 'legacy-process') !== (q.params === undefined))
|
|
384
|
+
invalid(field, q);
|
|
385
|
+
const intent = {
|
|
386
|
+
request: normalizedRequest,
|
|
387
|
+
...(governance ? { governance } : {}),
|
|
388
|
+
...(currencyCache ? { currencyCache } : {}),
|
|
389
|
+
...(treasury ? { treasury } : {}),
|
|
390
|
+
...(process ? { process } : {}),
|
|
391
|
+
quote: {
|
|
392
|
+
source: quoteSource,
|
|
393
|
+
...(q.params === undefined
|
|
394
|
+
? {}
|
|
395
|
+
: { params: feeQuoteParams(q.params, field) }),
|
|
396
|
+
},
|
|
397
|
+
};
|
|
398
|
+
const accounts = accountAddresses(row.accounts, field, [], ['starbaseGovernance', 'currencyCache', 'starbaseTreasury']);
|
|
399
|
+
if ((mode === 'crafting-complete'
|
|
400
|
+
? governance !== undefined ||
|
|
401
|
+
process?.address !== normalizedRequest.process
|
|
402
|
+
: process !== undefined || !governance) ||
|
|
403
|
+
accounts.starbaseGovernance !== governance?.address ||
|
|
404
|
+
accounts.currencyCache !== currencyCache?.address ||
|
|
405
|
+
accounts.starbaseTreasury !==
|
|
406
|
+
(treasury?.state === 'initialized' ? treasury.address : undefined))
|
|
407
|
+
invalid(field, row);
|
|
408
|
+
return deepFreeze({ ...base, kind: 'governance-fees', intent, accounts });
|
|
409
|
+
}
|
|
410
|
+
function layouts() {
|
|
411
|
+
return [
|
|
412
|
+
{
|
|
413
|
+
kind: 'market',
|
|
414
|
+
discriminator: PLACE_LOCAL_MARKET_ORDER_DISCRIMINATOR,
|
|
415
|
+
decoder: getPlaceLocalMarketOrderInstructionDataDecoder,
|
|
416
|
+
count: 15,
|
|
417
|
+
game: 4,
|
|
418
|
+
system: 6,
|
|
419
|
+
history: 12,
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
kind: 'market',
|
|
423
|
+
discriminator: CANCEL_LOCAL_MARKET_ORDERS_DISCRIMINATOR,
|
|
424
|
+
decoder: getCancelLocalMarketOrdersInstructionDataDecoder,
|
|
425
|
+
count: 15,
|
|
426
|
+
game: 4,
|
|
427
|
+
system: 6,
|
|
428
|
+
history: 12,
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
kind: 'crafting-start',
|
|
432
|
+
discriminator: START_CRAFTING_PROCESS_DISCRIMINATOR,
|
|
433
|
+
decoder: getStartCraftingProcessInstructionDataDecoder,
|
|
434
|
+
count: 19,
|
|
435
|
+
game: 5,
|
|
436
|
+
system: 6,
|
|
437
|
+
history: 16,
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
kind: 'crafting-complete',
|
|
441
|
+
discriminator: COMPLETE_CRAFTING_PROCESS_DISCRIMINATOR,
|
|
442
|
+
decoder: getCompleteCraftingProcessInstructionDataDecoder,
|
|
443
|
+
count: 19,
|
|
444
|
+
game: 5,
|
|
445
|
+
system: 6,
|
|
446
|
+
history: 16,
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
kind: 'attack',
|
|
450
|
+
discriminator: ATTACK_STARBASE_DISCRIMINATOR,
|
|
451
|
+
decoder: getAttackStarbaseInstructionDataDecoder,
|
|
452
|
+
count: 28,
|
|
453
|
+
game: 9,
|
|
454
|
+
system: 6,
|
|
455
|
+
history: 25,
|
|
456
|
+
},
|
|
457
|
+
];
|
|
458
|
+
}
|
|
459
|
+
function claimXpLayouts() {
|
|
460
|
+
return [
|
|
461
|
+
{
|
|
462
|
+
discriminator: PLACE_CLAIM_STAKE_BUILDINGS_DISCRIMINATOR,
|
|
463
|
+
decoder: getPlaceClaimStakeBuildingsInstructionDataDecoder,
|
|
464
|
+
count: 14,
|
|
465
|
+
game: 0,
|
|
466
|
+
structure: 6,
|
|
467
|
+
accrual: 13,
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
discriminator: CANCEL_CLAIM_STAKE_BUILDING_DESIGN_DISCRIMINATOR,
|
|
471
|
+
decoder: getCancelClaimStakeBuildingDesignInstructionDataDecoder,
|
|
472
|
+
count: 12,
|
|
473
|
+
game: 0,
|
|
474
|
+
structure: 5,
|
|
475
|
+
accrual: 11,
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
discriminator: FINALIZE_BUILDING_CHANGES_DISCRIMINATOR,
|
|
479
|
+
decoder: getFinalizeBuildingChangesInstructionDataDecoder,
|
|
480
|
+
count: 15,
|
|
481
|
+
game: 0,
|
|
482
|
+
structure: 6,
|
|
483
|
+
accrual: 14,
|
|
484
|
+
character: 5,
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
discriminator: START_CLAIM_STAKES_FLEET_TRANSFER_DISCRIMINATOR,
|
|
488
|
+
decoder: getStartClaimStakesFleetTransferInstructionDataDecoder,
|
|
489
|
+
count: 14,
|
|
490
|
+
game: 10,
|
|
491
|
+
structure: 5,
|
|
492
|
+
accrual: 13,
|
|
493
|
+
},
|
|
494
|
+
];
|
|
495
|
+
}
|
|
496
|
+
function validateClaimXpInstruction(step, layout, guards) {
|
|
497
|
+
const { accounts: metas, data } = step.instruction;
|
|
498
|
+
if (!metas || metas.length !== layout.count || !data)
|
|
499
|
+
changed();
|
|
500
|
+
try {
|
|
501
|
+
if (layout.decoder().read(data, 0)[1] !== data.length)
|
|
502
|
+
changed();
|
|
503
|
+
}
|
|
504
|
+
catch {
|
|
505
|
+
changed();
|
|
506
|
+
}
|
|
507
|
+
const game = metas[layout.game].address;
|
|
508
|
+
const structure = metas[layout.structure].address;
|
|
509
|
+
const character = layout.character === undefined
|
|
510
|
+
? undefined
|
|
511
|
+
: metas[layout.character].address;
|
|
512
|
+
const xp = guards.find((g) => g.kind === 'xp-runtime' &&
|
|
513
|
+
g.intent.game === game &&
|
|
514
|
+
g.intent.structure === structure &&
|
|
515
|
+
g.intent.character === character);
|
|
516
|
+
if (!xp)
|
|
517
|
+
changed();
|
|
518
|
+
const match = (index, address, writable) => {
|
|
519
|
+
if (address === undefined ||
|
|
520
|
+
metas[index].address !== address ||
|
|
521
|
+
metas[index].role !==
|
|
522
|
+
(writable ? AccountRole.WRITABLE : AccountRole.READONLY))
|
|
523
|
+
changed();
|
|
524
|
+
};
|
|
525
|
+
match(layout.game, game, false);
|
|
526
|
+
match(layout.structure, structure, true);
|
|
527
|
+
match(layout.accrual, xp.accounts.xpAccrual, true);
|
|
528
|
+
if (layout.character !== undefined) {
|
|
529
|
+
match(layout.character, character, true);
|
|
530
|
+
match(12, xp.accounts.xpBudget, true);
|
|
531
|
+
match(13, xp.accounts.xpBudgetConfig, false);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
/** Old layouts and unguarded persisted instructions fail before assembly or signing. */
|
|
535
|
+
export function validateRuntimeInstructions(steps, preconditions) {
|
|
536
|
+
const guards = preconditions.filter(isRuntimeGuard);
|
|
537
|
+
for (const step of steps) {
|
|
538
|
+
const { instruction } = step;
|
|
539
|
+
if (instruction.programAddress !== SAGE_PROGRAM_ADDRESS)
|
|
540
|
+
continue;
|
|
541
|
+
const claimLayout = claimXpLayouts().find((value) => value.discriminator.every((byte, index) => instruction.data?.[index] === byte));
|
|
542
|
+
if (claimLayout) {
|
|
543
|
+
validateClaimXpInstruction(step, claimLayout, guards);
|
|
544
|
+
continue;
|
|
545
|
+
}
|
|
546
|
+
const layout = layouts().find((value) => value.discriminator.every((byte, index) => instruction.data?.[index] === byte));
|
|
547
|
+
if (!layout)
|
|
548
|
+
continue;
|
|
549
|
+
const metas = instruction.accounts;
|
|
550
|
+
if (!metas || metas.length !== layout.count || !instruction.data)
|
|
551
|
+
changed();
|
|
552
|
+
try {
|
|
553
|
+
if (layout.decoder().read(instruction.data, 0)[1] !==
|
|
554
|
+
instruction.data.length)
|
|
555
|
+
changed();
|
|
556
|
+
}
|
|
557
|
+
catch {
|
|
558
|
+
changed();
|
|
559
|
+
}
|
|
560
|
+
const game = metas[layout.game].address;
|
|
561
|
+
const system = metas[layout.system].address;
|
|
562
|
+
const match = (index, expected, writable = false) => {
|
|
563
|
+
const actual = metas[index];
|
|
564
|
+
if (actual?.address !== (expected ?? SAGE_PROGRAM_ADDRESS) ||
|
|
565
|
+
actual.role !==
|
|
566
|
+
(expected && writable ? AccountRole.WRITABLE : AccountRole.READONLY))
|
|
567
|
+
changed();
|
|
568
|
+
};
|
|
569
|
+
match(layout.game, game);
|
|
570
|
+
match(layout.system, system, layout.kind === 'attack');
|
|
571
|
+
const h = guards.find((g) => g.kind === 'democracy-history' &&
|
|
572
|
+
g.intent.game === game &&
|
|
573
|
+
g.intent.system === system &&
|
|
574
|
+
g.address === metas[layout.history].address);
|
|
575
|
+
if (!h)
|
|
576
|
+
changed();
|
|
577
|
+
match(layout.history, h.accounts.democracyHistoryHistory, layout.kind !== 'crafting-start');
|
|
578
|
+
match(layout.history + 1, h.accounts.democracyHistoryPolicy);
|
|
579
|
+
match(layout.history + 2, h.accounts.democracyHistoryGeneration, layout.kind !== 'crafting-start');
|
|
580
|
+
if (layout.kind !== 'market') {
|
|
581
|
+
const structureIndex = layout.kind === 'crafting-start'
|
|
582
|
+
? 11
|
|
583
|
+
: layout.kind === 'crafting-complete'
|
|
584
|
+
? 9
|
|
585
|
+
: undefined;
|
|
586
|
+
const structure = structureIndex === undefined ||
|
|
587
|
+
metas[structureIndex].address === SAGE_PROGRAM_ADDRESS
|
|
588
|
+
? undefined
|
|
589
|
+
: metas[structureIndex].address;
|
|
590
|
+
const character = layout.kind === 'crafting-start' ? undefined : metas[4].address;
|
|
591
|
+
const xp = guards.find((g) => g.kind === 'xp-runtime' &&
|
|
592
|
+
g.intent.game === game &&
|
|
593
|
+
g.intent.character === character &&
|
|
594
|
+
g.intent.structure === structure);
|
|
595
|
+
if (!xp)
|
|
596
|
+
changed();
|
|
597
|
+
match(4, metas[4].address, true);
|
|
598
|
+
if (structureIndex !== undefined)
|
|
599
|
+
match(structureIndex, structure, true);
|
|
600
|
+
if (layout.kind !== 'crafting-start') {
|
|
601
|
+
match(layout.kind === 'attack' ? 23 : 13, xp.accounts.xpBudget, true);
|
|
602
|
+
match(layout.kind === 'attack' ? 24 : 14, xp.accounts.xpBudgetConfig);
|
|
603
|
+
}
|
|
604
|
+
if (layout.kind !== 'attack')
|
|
605
|
+
match(15, xp.accounts.xpAccrual, true);
|
|
606
|
+
}
|
|
607
|
+
if (layout.kind !== 'attack') {
|
|
608
|
+
const habIndex = layout.kind === 'crafting-start'
|
|
609
|
+
? 11
|
|
610
|
+
: layout.kind === 'crafting-complete'
|
|
611
|
+
? 9
|
|
612
|
+
: undefined;
|
|
613
|
+
const hasHab = habIndex !== undefined &&
|
|
614
|
+
metas[habIndex].address !== SAGE_PROGRAM_ADDRESS;
|
|
615
|
+
const fee = guards.find((g) => g.kind === 'governance-fees' &&
|
|
616
|
+
g.intent.request.game === game &&
|
|
617
|
+
g.intent.request.system === system &&
|
|
618
|
+
g.intent.request.mode === layout.kind &&
|
|
619
|
+
Boolean(g.intent.request.hasHab) === hasHab &&
|
|
620
|
+
(layout.kind !== 'crafting-complete' ||
|
|
621
|
+
g.intent.request.process === metas[10].address));
|
|
622
|
+
if (!fee)
|
|
623
|
+
changed();
|
|
624
|
+
if (layout.kind !== 'crafting-complete')
|
|
625
|
+
match(layout.kind === 'market' ? 9 : 14, fee.accounts.starbaseGovernance);
|
|
626
|
+
match(layout.kind === 'market'
|
|
627
|
+
? 10
|
|
628
|
+
: layout.kind === 'crafting-start'
|
|
629
|
+
? 12
|
|
630
|
+
: 11, fee.accounts.currencyCache, true);
|
|
631
|
+
if (layout.kind !== 'crafting-start')
|
|
632
|
+
match(layout.kind === 'market' ? 11 : 12, fee.accounts.starbaseTreasury, true);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
//# sourceMappingURL=runtime-guards.js.map
|